# Joystick Issue: Connection to joystick device lost unexpectedly

**URL:** https://discuss.bluerobotics.com/t/joystick-issue-connection-to-joystick-device-lost-unexpectedly/1902
**Category:** Blue Robotics Software
**Created:** [December 22, 2017, 3:20pm UTC](https://discuss.bluerobotics.com/t/joystick-issue-connection-to-joystick-device-lost-unexpectedly/1902 "2017-12-22T15:20:24Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![imoe](https://avatars.discourse-cdn.com/v4/letter/i/3be4f8/32.png) [@imoe](https://discuss.bluerobotics.com/u/imoe)
#### Post date: [December 22, 2017, 3:20pm UTC](https://discuss.bluerobotics.com/t/joystick-issue-connection-to-joystick-device-lost-unexpectedly/1902/1 "2017-12-22T15:20:24Z")

</div>

Hi there,

I’m trying to use bluerov and bluerov\_app ROS packages to control my BlueROV. The approach I’m trying now is to control the ROV using joystick through ROS and then send commands to joystick topic to control the ROV autonomously. (Is this a good approach? Is there any other recommended way to do this?)

I’m now running:

- ROS master my ground computer
- launch bluerov\_r1.launch on companion computer(RPi with Ubuntu image, ROS and bluerov pkgs installed)
- launch joystick node in bluerov\_apps pkg on ground PC with joystick connected to it

I always receive message in joystick console as

> Connection to joystick device lost unexpectedly. Will reopen.

Even if I tried to run all the nodes on ground PC, the same problem occurs again.  
If I run the original ROS node for joystick ( rosrun joy joy\_node\_teleop), this error doesn’t appear.

Has anybody faced this problem?

---

<div class="post-metadata">

### Author: ![patrickelectric](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/patrickelectric/32/2162_2.png) [@patrickelectric](https://discuss.bluerobotics.com/u/patrickelectric)
#### Post date: [December 22, 2017, 4:02pm UTC](https://discuss.bluerobotics.com/t/joystick-issue-connection-to-joystick-device-lost-unexpectedly/1902/2 "2017-12-22T16:02:28Z")

</div>

Hi @imoe,

> [@imoe](#):
>
> I’m trying to use bluerov and bluerov\_app ROS packages to control my BlueROV. The approach I’m trying now is to control the ROV using joystick through ROS and then send commands to joystick topic to control the ROV autonomously. (Is this a good approach? Is there any other recommended way to do this?)

This is one of the possible approaches, you can use the actual bluerov package to perform this, right now we are working on a new package ([bluerov\_ros\_playground](https://github.com/patrickelectric/bluerov_ros_playground)) and almost done for a release. Maybe you want to try it to do some simulations or control the ROV.

About your problem with the old package, can you show all the commands that you are using to launch the teleop ?

---

<div class="post-metadata">

### Author: ![imoe](https://avatars.discourse-cdn.com/v4/letter/i/3be4f8/32.png) [@imoe](https://discuss.bluerobotics.com/u/imoe)
#### Post date: [December 23, 2017, 10:23am UTC](https://discuss.bluerobotics.com/t/joystick-issue-connection-to-joystick-device-lost-unexpectedly/1902/3 "2017-12-23T10:23:34Z")

</div>

Hi @patrickelectric, thanks for your response.

What I’m trying to do is to control Pixhawk through MavROS to make the ROV fully autonomous as these commands can be sent from companion computer( where I installed Ubuntu 16 and ROS kinect as well as bluerov pkgs on the companion RPi). Now my ground PC and RPi with Ubuntu are both ROS and bluerov pkgs installed, configured in a same network.  
My commands are:

> roscore (on ground PC as it’s currently set to be ROS master)  
> roslaunch bluerov bluerov\_r1.launch ( on RPi as the Pixhawk is connect to it and camera module is on it)  
> roslaunch bluerov\_apps teleop\_f310.launch ( on ground PC as I connect the joystick to it)

Here’s the rqt\_graph at this time.

 ![rosgraph](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/6/6b8d61940d41c6012fe132f187d904ef8db2090b.jpg)  
Then the error below appears whenever I sent any command through joystick.

> Connection to joystick device lost unexpectedly. Will reopen.

I also tried to send some commands directly through rosservice or rostopic pub, but only one of them worked.

> rosservice call /mavros/cmd/arming “value: true”

By using this command, I can arm the ROV(indicated by the LED on PixHawk). But other commands such as publish to setpoint\_velocity don’t work(no motor rotates).

Joystick control via QGroundControl is always fine. But I need to

1. Use joystick node in ROS to control the vehicle
2. Send command through ROS to control the vehicle( through waypoints, etc)

Any suggestions? Thank you. (Hope I have stated everything clear)

---

<div class="post-metadata">

### Author: ![patrickelectric](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/patrickelectric/32/2162_2.png) [@patrickelectric](https://discuss.bluerobotics.com/u/patrickelectric)
#### Post date: [December 23, 2017, 10:54am UTC](https://discuss.bluerobotics.com/t/joystick-issue-connection-to-joystick-device-lost-unexpectedly/1902/4 "2017-12-23T10:54:47Z")

</div>

You are not able to set speed reference without a position system (E.g: GPS), the software derivative the position to use it as a velocity reference for the control loop.  
Take a look [here](http://ardupilot.org/copter/docs/flight-modes.html#gps-dependency) to check the modes that you can use with/without position reference.

> [@imoe](#):
>
> roslaunch bluerov\_apps teleop\_f310.launch ( on ground PC as I connect the joystick to it)

Are you using the F310 joystick ? Do you see the device in /dev ?

> [@imoe](#):
>
> Send command through ROS to control the vehicle( through waypoints, etc)

If you want to test the RC, you can use: `rostopic pub -r 1 /mavros/rc/override mavros_msgs/OverrideRCIn '[1300, 1300, 1300, 1300, 0, 0, 0, 0]'`

To control it using waypoints you’ll need a position system.

---

<div class="post-metadata">

### Author: ![imoe](https://avatars.discourse-cdn.com/v4/letter/i/3be4f8/32.png) [@imoe](https://discuss.bluerobotics.com/u/imoe)
#### Post date: [December 23, 2017, 12:17pm UTC](https://discuss.bluerobotics.com/t/joystick-issue-connection-to-joystick-device-lost-unexpectedly/1902/5 "2017-12-23T12:17:31Z")

</div>

> [@patrickelectric](#):
>
> Are you using the F310 joystick ? Do you see the device in /dev ?

Thanks for this. I check the devices and found out my F310 is /dev/input/js0. After changing corresponding line in the f310 launch file, it worked!

> [@patrickelectric](#):
>
> If you want to test the RC, you can use: rostopic pub -r 1 /mavros/rc/override mavros\_msgs/OverrideRCIn ‘[1300, 1300, 1300, 1300, 0, 0, 0, 0]’

This works fine on my side. Thanks!

> [@patrickelectric](#):
>
> You are not able to set speed reference without a position system (E.g: GPS), the software derivative the position to use it as a velocity reference for the control loop.
> 
> Take a look here to check the modes that you can use with/without position reference.

My questions here are:

1. Then if there’s no position system, how do you send commands to the ROV to control it other than direct OverrideRCIn? For example is it possible to let it go 1m in x direction or something similar? Will only IMU information be enough for the ROV to move desirably?
2. What are the position system you guys are using for the ROV? I guess USBL?  
In theory, if I can send position information to the ROV (even if I put it on the ground and use motion capture or GPS), it will take waypoint commands, right?

Thanks again for your reply, it really helps!

---

<div class="post-metadata">

### Author: ![patrickelectric](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/patrickelectric/32/2162_2.png) [@patrickelectric](https://discuss.bluerobotics.com/u/patrickelectric)
#### Post date: [December 23, 2017, 12:36pm UTC](https://discuss.bluerobotics.com/t/joystick-issue-connection-to-joystick-device-lost-unexpectedly/1902/6 "2017-12-23T12:36:37Z")

</div>

> [@imoe](#):
>
> Then if there’s no position system, how do you send commands to the ROV to control it other than direct OverrideRCIn? For example is it possible to let it go 1m in x direction or something similar? Will only IMU information be enough for the ROV to move desirably?  
> What are the position system you guys are using for the ROV? I guess USBL?

It’s not possible to send position or velocity commands without a position system, the IMU is not enough to estimate velocity or a Cartesian position.

> [@imoe](#):
>
> What are the position system you guys are using for the ROV? I guess USBL?

[Here](https://www.bluerobotics.com/product-category/electronics/underwater-gps/) you can check our underwater GPS products.

> [@imoe](#):
>
> In theory, if I can send position information to the ROV (even if I put it on the ground and use motion capture or GPS), it will take waypoint commands, right?

Yes, that’s correct, you can send the position information via MAVLink 🙂

If you want to check how each mode work, take a look [here](https://github.com/bluerobotics/ardusub/tree/master/ArduSub), the file is: control\_ **mode**.cpp
