Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pair PS3 controller after upgrading to 18.04 #66

Closed
umhan35 opened this issue Apr 17, 2019 · 8 comments
Closed

How to pair PS3 controller after upgrading to 18.04 #66

umhan35 opened this issue Apr 17, 2019 · 8 comments
Assignees

Comments

@umhan35
Copy link

umhan35 commented Apr 17, 2019

PS4 controller does not work after we upgrade to 18.04. http://docs.fetchrobotics.com/indigo_to_melodic.html does not say anything but:

Check whether your PS3 controller pairs and controls the robot.

Important note: The PS3 controller currently won’t work with ROS by default. To fix this, run sudo ln -s /dev/input/js0 /dev/ps3joy. We hope to fix this by fixing the corresponding udev rules eventually.

Important note: for 18.04 the robots have switched from using sixad to using PS3joy. Some changes in behaviour you may see:

The LEDs on the PS3 controller may continually blink, even though it is connected.
Inputs may not be sent from the PS3 controller if the accelerometers in the controller do not detect motion. This can result in jerky motion when using the controller.
We are hoping to determine fixes for these in the near future.

There is an old command here http://docs.fetchrobotics.com/in_the_box.html?highlight=pair sudo sixpair, but does not apply anymore.

@erelson

@umhan35 umhan35 changed the title How to pair PS4 controller after upgrading to 18.04 How to pair PS3 controller after upgrading to 18.04 Apr 17, 2019
@moriarty
Copy link
Contributor

I think this is likely a missing udev rule.

@erelson I think we could also just default to /dev/input/js0 instead of expecting the udev rule to remap it for us.

@erelson
Copy link
Collaborator

erelson commented Apr 17, 2019

@umhan35 thanks for letting us know you're encountering these issues!

My guess is the following should get you into a working state for now:

ls /dev/input/js*  # should be empty
sudo service roscore start  # assuming that roscore isn't running when the robot starts up
# alternately, `sudo service ps3joy start` but this should be launched if roscore starts
sudo ln -s /dev/input/js0 /dev/ps3joy
# connect the controller by pressing the middle button
ls /dev/input/js*  # should not be empty now
jstest /dev/input/js0   # should show feedback if buttons are pressed on controller/joysticks are moved.
rostopic echo /joy  # should show feedback if buttons are pressed on controller/joysticks are moved.

If that doesn't work, a short-term workaround will be to run it manually with sudo su -c ". /opt/ros/melodic/setup.bash && rosrun ps3joy ps3joy.py --inactivity-timeout=3600"

FYI, you should not need to re-pair the controller, as the pairing is a hardware thing between the controller and the bluetooth chip, neither of which change when the OS upgrade/reinstall is done. But, I will need to update documentation to point out that the new command will be sudo /opt/ros/melodic/lib/ps3joy/sixpair.

@umhan35
Copy link
Author

umhan35 commented Apr 19, 2019

Thanks, @erelson. I tried ls before I post this issue and now I am glad to know the two commands and both jstest /dev/input/js0 and rostopic echo /joyshow feedback when I press controller buttons. But manually running sudo su -c ". /opt/ros/melodic/setup.bash && rosrun ps3joy ps3joy.py --inactivity-timeout=3600" gives me this error:

$ sudo su -c ". /opt/ros/melodic/setup.bash && rosrun ps3joy
3joy.py --inactivity-timeout=3600"
Inactivity timeout set to 3600 seconds.
error(98, 'Address already in use')
Error binding to socket, will retry every 5 seconds. Do you have another ps3joy.
py running? This error occurs on some distributions (such as Ubuntu Karmic). Please read http://www.ros.org/wiki/ps3joy/Troubleshooting for solutions.
error(98, 'Address already in use')
error(98, 'Address already in use')
error(98, 'Address already in use')
error(98, 'Address already in use')
error(98, 'Address already in use')
^C
Session terminated, terminating shell...CTRL+C detected. Exiting.
 ...terminated.

I am reading the troubleshooting webpage now...

@umhan35
Copy link
Author

umhan35 commented Apr 19, 2019

@erelson I just confirmed that, by connecting HDMI cable to the robot, the Bluetooth indicator is Off. When I open the bluetooth setting and try to turn it on, the switch UI elements turned green but the label is off, and the list is still empty. It seems the bluetooth driver is not installed properly?

I took a video, take a look: https://photos.app.goo.gl/x8S6k7zpjYTcH2Vs6

@umhan35
Copy link
Author

umhan35 commented Apr 19, 2019

@erelson Any update on this? Now roscore can start automatically but I still get the same error when running ps3joy.

@erelson
Copy link
Collaborator

erelson commented Apr 20, 2019

We are having similar issues inhouse as well, sometimes.

A quick fix I found is that if the /joy topic is publishing, but the robot is not moving, you can do sudo service robot stop && sudo service robot start and tele-op might start working (it did for us...)

Then to get around the need to create /dev/ps3joy (which ultimately seems to be due to udev rules not triggering), a hack that will work in the meantime is to edit your robot's /etc/ros/melodic/robot.launch:

   <!-- Teleop -->
-  <include file="$(find fetch_bringup)/launch/include/teleop.launch.xml" />
+  <include file="$(find fetch_bringup)/launch/include/teleop.launch.xml">
+    <arg name="joy_device" value="/dev/input/js0" />
+  </include>

My testing is limited so far, but that may make the PS3 controller work at startup. Let me know what you find.

Finally, a related note: with the melodic release of fetch_teleop (? or similar package name), note that we changed the (undocumented) cartesian arm teleop control to also require the primary deadman button to be held down at the same time.

@umhan35
Copy link
Author

umhan35 commented Apr 20, 2019

It works by changing /etc/ros/melodic/robot.launch. But will it be overwritten once a new version of fetch-melodic-config.deb is published? Or just default to /dev/input/js0?

@erelson
Copy link
Collaborator

erelson commented Apr 20, 2019

We specifically avoid changing any files in/etc/ros/melodic/ with new releases, so the change will persist.

I am hoping to find a overall better setup for PS3 controllers eventually. If anything, a proper setup might necessitate reverting this change later (but perhaps only if you move to using a different controller for teleop).

Thanks for confirming!

@erelson erelson closed this as completed Apr 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants