Git Product home page Git Product logo

ds4_driver's Introduction

ds4_driver

DualShock 4 driver for ROS.

Features

  • Get information such as IMU, battery, and touchpad from your DualShock 4.
  • Use feedback such as rumble, LED color, and LED flash via ROS topics.
  • Connect to your controller via Bluetooth.
  • Utility node included to publish velocity commands from inputs

Installation and Usage

Native

This driver depends on ds4drv. Some features of this driver depend on pull requests have not yet been merged upstream. Until they are merged, use naoki-mizuno/ds4drv (devel branch).

$ git clone https://github.com/naoki-mizuno/ds4drv --branch devel
$ cd ds4drv
$ mkdir -p ~/.local/lib/python3.10/site-packages
$ python3 setup.py install --prefix ~/.local
# Note: udev directory is in the ds4drv repo, not ds4_driver (this repo)
$ sudo cp udev/50-ds4drv.rules /etc/udev/rules.d/
$ sudo udevadm control --reload-rules
$ sudo udevadm trigger

Compile and source this package just like any other ROS package. To run,

$ ros2 launch ds4_driver ds4_driver.launch.xml
# Or
$ ros2 run ds4_driver ds4_driver_node.py

Get a glimpse of some of the features of ds4_driver including touchpad, rumble, and LED control:

$ ros2 launch ds4_driver demo.launch.xml
# See the messages that are published
$ ros2 topic echo /status

Moving the left/right stick controls the rumble. Sliding left and right on the touchpad while pressing circle, triangle, cross buttons controls the brightness of the red, green, blue LED, respectively (you can tell from the color of the button). Pressing the PS button triggers the flashing of the LED.

Docker

A docker image is provided on Docker Hub, as well as a Dockerfile that can be used to build an image.

$ ./run_docker.bash
# Takes you into the container's interactive shell
$ ros2 launch ds4_driver demo.launch.xml

Or if you want to build the image,

docker build ./docker

ds4_driver_node.py

This is the main node that interacts with DualShock 4.

Parameters

  • ~device_addr: hardware address of the device. If unspecified, will use the first device found.
  • ~backend (default: hidraw): what backend to use to connect to the device via Bluetooth. bluetooth is only there for legacy support and has not been tested. Refer to the docs in ds4drv for details.
  • ~use_standard_msgs (default: false): use ROS-standard messages such as sensor_msgs/Joy.
  • ~autorepeat_rate (default: 0 (disabled)): rate in Hz at which a joystick that has a non-changing state will resend the previously sent message. This parameter is only effective when use_standard_msgs is true.
  • ~deadzone (default: 0.1): amount by which the joystick has to move before it is considered to be off-center.
  • ~frame_id: (default: ds4): frame ID to be used for the messages.
  • ~imu_frame_id (default: ds4_imu): frame ID to be used for the IMU messages.

Topics

Published

  • /status (ds4_driver_msgs/Status): current state of the device.

Subscribed

  • /set_feedback (ds4_driver_msgs/Feedback): feedback for the device such as LED color, rumble, and LED flash.

Note: To disable flash, send message with set_led_flash: true and led_flash_off: 0.

Topics (when use_standard_msgs is true)

Published

  • /raw_report (ds4_driver_msgs/Report): raw, uninterpreted report that the device sends.
  • /battery (sensor_msgs/BatteryState): battery state of the device.
  • /joy (sensor_msgs/Joy): joypad state.
  • /imu (sensor_msgs/Imu): IMU state.

Subscribed

  • /set_feedback (sensor_msgs/JoyFeedbackArray): feedback for the device.

ds4_twist_node.py

A node to convert joypad inputs to velocity commands is included in this package. This node is something similar to teleop_twist_joy but is specifically for a DualShock 4.

Parameters

  • ~stamped (default: false): whether to publish Twist or TwistStamped for the output velocity command. For robots such as TurtleBot, Husky, and PR2 /cmd_vel is not stamped (i.e. Twist is used) but stamped velocity commands may be required for some applications.
  • ~inputs: what buttons and axes to use for the value of each velocity vector. Expressions can be used to combine values of multiple keys (see config/twist_6dof.yaml for examples).
  • ~scales: scaling factor for each velocity vector.

Topics

Published

  • /cmd_vel (geometry_msgs/Twist or geometry_msgs/TwistStamped): velocity command.

Subscribed

  • /status (ds4_driver_msgs/Status): joypad state.

Notes

Disable touchpad input device

Note: You can skip this section if you use the forked version of ds4drv (i.e. naoki-mizuno/ds4drv) because the following line is included in the udev rules by default.

By default the touchpad of the DualShock 4 is recognized as an input device. Because of this, the mouse moves to the location on screen that corresponds to the location touched, making it very hard to track the mouse cursor (and worse, it automatically clicks at that location). If you want to prevent the touchpad from being recognized as an input device, add the following to the udev rules and run the udevadm commands (you will still be able to use the touchpad from this driver):

SUBSYSTEM=="input", ATTRS{name}=="*Wireless Controller Touchpad", RUN+="/bin/rm %E{DEVNAME}", ENV{ID_INPUT_JOYSTICK}=""

License

MIT

Author

Naoki Mizuno ([email protected])

ds4_driver's People

Contributors

adityakamath avatar aposhian avatar edwardabrosimov avatar geoporus1 avatar naoki-mizuno avatar vinnnyr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ds4_driver's Issues

ROS2 Foxy Support

Hello,
I am interested in developing a ROS2 / Foxy support version of this driver. I am in progress doing so, and I was wondering if there is interest in holding it here in a branch called foxy-devel or is it preferred that I keep the changes in another fork since there may be significant changes?

Causes Screen to Rotate 180

When I boot my computer (Macbook running Ubuntu 18) with the PS4 controller plugged in the USB after the boot loader finishes the screen output is rotated 180 degrees. This did not happen before and only occurs when the PS4 controller is plugged in during boot. It works okay if I plug it in after boot though.

Replicated it on an older Macbook running Ubuntu 18 as well.

ds4_twist_node crashes on foxy-devel

I am having trouble running the "ds4_twist_node.py " on the "foxy-devel" branch.

the python script crashes on line 73:

val = eval(expr, {}, input_vals)

as the expr is allways of type None!

thanks for the support

Installation guide fix

The guide give on below of Installation and Usage needs to minor fixes
after the cd ds4drv
mkdir ~/.local/lib/python2.7/site-packages
or else you get errors that this path does not exist
and before the line
sudo cp 50-ds4drv.rules /etc/udev/rules.d/
the command
cd udev

[ds4_driver_node.py-1] AttributeError: module 'rclpy' has no attribute 'Timer'

Hello!

I am currently working on a project with a bigger robot and I am migrating the code base from ros1 to ros2. In the past I have successfully used your ds4_driver (for which I am eternally thankful :) ) with ros1 melodic without any issues whatsoever. However, now, when I am trying to use the version from the foxy-devel branch, the ds4_driver_node.py fails with the error [ds4_driver_node.py-1] AttributeError: module 'rclpy' has no attribute 'Timer'. This error looks really weird to me as when checking the latest rclpy 0.6.1 documentation it seems like there is no way to instantiate a new timer by just calling rclpy.Timer(). Moreso, when I import rclpy into a simple python terminal and try to do rclpy.Timer() I get the same error.

The weirdness does not stop here. In the ds4_driver_node.py there are 2 places where a Timer is created in this manner and one of them is a "oneshot" timer, which was a really neat feature to have in rospy but during my short development lately with ros2 I have seen that rclpy doesn't even support oneshot timers anymore.

I have forked this repo and tried to convert the timers to the format documented in the official rospy 0.6.1 documentation but just ran into more weird errors. The thing is that when I am running the driver from inside the docker container built with the provided dockerfile, the error does not appear when doing ros2 run ds4_driver ds4_driver_node.py but if i again just open a simple python terminal inside the container and try to import rclpy.Timer (as done in the script), I get the same error [ds4_driver_node.py-1] AttributeError: module 'rclpy' has no attribute 'Timer'.

All things found and said above lead me to believe that somehow the foxy version of the ds4_driver has been developed with an older version of rclpy which was still in early development. I would like to modify it to work with rclpy 0.6.1 (if this is the actual issue) but I have no clue what older version was used for developing the current version in the foxy-devel branch. Do you have any idea what version was used or why do I keep bumping into that error if my assumptions above are not correct? Any help will be appreciated and if needed I can help with bringing the foxy version up-to date with a pull-request, once I figure out why all these things are happening!

Cheers!

Noetic support

It would be nice to support the latest (and last) ROS1 distro. The code should be runnable in Noetic, but there may be some minor modifications required regarding python 2 vs 3 compatibility.

ds4_twist_node error

I just need to clarify that I am still a beginner in ROS in general, so the issue is whenever i hit "rosrun ds4_driver ds4_twist_node.py " i get an error :
Traceback (most recent call last):
File "/home/ahmedso3da/catkin_ws/src/ds4_driver/nodes/ds4_twist_node.py", line 64, in
main()
File "/home/ahmedso3da/catkin_ws/src/ds4_driver/nodes/ds4_twist_node.py", line 58, in main
StatusToTwist()
File "/home/ahmedso3da/catkin_ws/src/ds4_driver/nodes/ds4_twist_node.py", line 16, in init
self._inputs = rospy.get_param('~inputs')
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/client.py", line 465, in get_param
return _param_server[param_name] #MasterProxy does all the magic for us
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/msproxy.py", line 123, in getitem
raise KeyError(key)
KeyError: '~inputs'

Compatiblity with Noetic?

I've tried to use this ds4_driver on noetic but I get this error. I suppose it is not compatible, isn't?

roslaunch ds4_driver ds4_driver.launch.xml
... logging to /home/ubuntu/.ros/log/59a55ef4-6f8c-11ec-9b33-c544238f7f4a/roslaunch-ubuntu-30598.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

RLException: <node> tag is missing required attribute: 'type'. Node xml is <node pkg="ds4_driver" exec="ds4_driver_node.py" name="ds4_driver" output="screen">
    <param from="$(find-pkg-share ds4_driver)/config/params.yaml"/>

    <param name="device_addr" value="$(var addr)"/>
    <param name="use_standard_msgs" value="$(var use_standard_msgs)"/>
    <param name="autorepeat_rate" value="$(var autorepeat_rate)"/>
  </node>
The traceback for the exception was written to the log file

ModuleNotFoundError: No module named 'ds4_driver'

Hello, I am having a bit of trouble running this node in ROS. I've had the issue on a couple of different computers now so I feel like I am missing something.

I issue the following command: roslaunch ds4_driver demo.launch

and I get the following output

*... logging to /home/phil/.ros/log/1d42605c-9696-11ec-8389-39ca2d45ed29/roslaunch-phil-Inspiron-3505-35204.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://phil-Inspiron-3505:33449/

SUMMARY
========

PARAMETERS
 * /ds4_driver/autorepeat_rate: 0.0
 * /ds4_driver/deadzone: 0.1
 * /ds4_driver/device_addr: 
 * /ds4_driver/use_standard_msgs: False
 * /rosdistro: noetic
 * /rosversion: 1.15.14

NODES
  /
    demo (ds4_driver/demo.py)
    ds4_driver (ds4_driver/ds4_driver_node.py)
    ds4_to_imu (tf2_ros/static_transform_publisher)

auto-starting new master
process[master]: started with pid [35212]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 1d42605c-9696-11ec-8389-39ca2d45ed29
process[rosout-1]: started with pid [35222]
started core service [/rosout]
process[demo-2]: started with pid [35229]
process[ds4_driver-3]: started with pid [35230]
process[ds4_to_imu-4]: started with pid [35231]
Traceback (most recent call last):
  File "/home/phil/catkin_ws/devel/lib/ds4_driver/ds4_driver_node.py", line 15, in <module>
    exec(compile(fh.read(), python_script, 'exec'), context)
  File "/home/phil/catkin_ws/src/ds4_driver/nodes/ds4_driver_node.py", line 3, in <module>
    from ds4_driver.logger import Logger
ModuleNotFoundError: No module named 'ds4_driver'
_[ds4_driver-3] process has died [pid 35230, exit code 1, cmd /home/phil/catkin_ws/devel/lib/ds4_driver/ds4_driver_node.py __name:=ds4_driver __log:=/home/phil/.ros/log/1d42605c-9696-11ec-8389-39ca2d45ed29/ds4_driver-3.log].
log file: /home/phil/.ros/log/1d42605c-9696-11ec-8389-39ca2d45ed29/ds4_driver-3*.log
Traceback (most recent call last):_
  File "/home/phil/catkin_ws/devel/lib/ds4_driver/demo.py", line 15, in <module>
    exec(compile(fh.read(), python_script, 'exec'), context)
  File "/home/phil/catkin_ws/src/ds4_driver/nodes/demo.py", line 4, in <module>
    from ds4_driver.msg import Feedback, Status
ModuleNotFoundError: No module named 'ds4_driver'
_[demo-2] process has died [pid 35229, exit code 1, cmd /home/phil/catkin_ws/devel/lib/ds4_driver/demo.py __name:=demo __log:=/home/phil/.ros/log/1d42605c-9696-11ec-8389-39ca2d45ed29/demo-2.log].
log file: /home/phil/.ros/log/1d42605c-9696-11ec-8389-39ca2d45ed29/demo-2*.log*_

I am using a fresh copy of Ubuntu 20.04.4, running ROS Noetic installed plus Gazebo. This is the only thing I've installed on this system so far.

When installing ds4_drv I followed the instructions on the noetic branch, downloading the ds4drv driver exactly how it says in the instructions, and ran into no problems in doing so.

I git cloned the noetic branch of ds4_driver directly to my src folder and used catkin_make to compile. There were no issues on compilation.

I am not quite sure what is going on, I suspected it was a problem with my python setup but I am not quite experienced enough in python to understand what is going on. I thought starting completely fresh would help but the problem persists.

controller fails to reconnect after accidental disconnect due to faulty use of rclpy.spin, wrong usage of rclpy.shutdown_now(), wrong approach ot destroying the one-shot timer in controller_ros.py

Hello @naoki-mizuno! After we successfully merged the latest changes to the foxy-devel branch I have continued working with the ds4_driver and spotted some more issues:

  • in ds4_driver_node.py there is an incorrect usage of rclpy.shutdown_now(), a function which I have been unable to find in the current rclpy documentation. Needs to be replaced with rclpy.shutdown()
  • the way in which spinning is handled now in ds4_driver_node.py renders the controller to be unable to reconnect if it is disconnected at some point at runtime.
  • the way in which i have tried to destroy the one-shot timer reference in controller_ros.py was not correct previously and needs to be updated to the correct one.

I have opened a new pull request #19 for the foxy-devel branch in which I am addressing all of these issues with proper fixes which I have also tested thoroughly. Please check the new changes whenever you got the time and let me know if you think they are suitable.

Issues on Humble

I am having some issues with the Humble branch, which I am unable to explain. I first thought I was having some connection issues, but then realized that the ds4_twist_node stops publishing any data altogether after a while (the /status topic is published and the twist_node seems to be subscribed). Also the /set_feedback (rumble/led control) does not work. I don't think this is because of my recent commits (separating the messages from the nodes), but I am not entirely sure.

For context, I am using Ubuntu 22.04.1 with a RT kernel (Kernel version: 5.15.39-rt42-raspi), so I am not sure if that is causing any issue. I was wondering if someone else can test the Humble branch (with any config) and check if they also have the same problem, or if it is just me.

Meanwhile, I would recommend going back to foxy-devel as the default branch and adding an "untested" comment in the readme of the Humble branch.

[foxy-devel] unhandled exceptions on controller disconnection

Hello!

In the last couple of weeks I have seen these things happening over multiple development and testing sessions with the foxy branch of the ds4_driver. Basically what happens is that if we try to send any command to the controller after it has disconnected or died due to low battery, then some OSError exceptions are raised which are not properly caught in the current version. I have stack traces for 2 of them:

[ds4_driver_node.py-18] Exception in thread Thread-2:
[ds4_driver_node.py-18] Traceback (most recent call last):
[ds4_driver_node.py-18]   File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
[ds4_driver_node.py-18]     self.run()
[ds4_driver_node.py-18]   File "/usr/lib/python3.8/threading.py", line 870, in run
[ds4_driver_node.py-18]     self._target(*self._args, **self._kwargs)
[ds4_driver_node.py-18]   File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/__init__.py", line 191, in spin
[ds4_driver_node.py-18]     executor.spin_once()
[ds4_driver_node.py-18]   File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/executors.py", line 714, in spin_once
[ds4_driver_node.py-18]     raise handler.exception()
[ds4_driver_node.py-18]   File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/task.py", line 239, in __call__
[ds4_driver_node.py-18]     self._handler.send(None)
[ds4_driver_node.py-18]   File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/executors.py", line 429, in handler
[ds4_driver_node.py-18]     await call_coroutine(entity, arg)
[ds4_driver_node.py-18]   File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/executors.py", line 354, in _execute_subscription
[ds4_driver_node.py-18]     await await_or_execute(sub.callback, msg)
[ds4_driver_node.py-18]   File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/executors.py", line 118, in await_or_execute
[ds4_driver_node.py-18]     return callback(*args)
[ds4_driver_node.py-18]   File "/karelics_workspace/karelics_brain/package_ws/install/ds4_driver/lib/python3.8/site-packages/ds4_driver/controller_ros.py", line 108, in cb_feedback
[ds4_driver_node.py-18]     self.control(
[ds4_driver_node.py-18]   File "/karelics_workspace/karelics_brain/package_ws/install/ds4_driver/lib/python3.8/site-packages/ds4_driver/controller.py", line 89, in control
[ds4_driver_node.py-18]     self._control()
[ds4_driver_node.py-18]   File "/karelics_workspace/karelics_brain/package_ws/install/ds4_driver/lib/python3.8/site-packages/ds4_driver/controller.py", line 95, in _control
[ds4_driver_node.py-18]     self.device.control(led_red=self._led[0],
[ds4_driver_node.py-18]   File "/usr/local/lib/python3.8/dist-packages/ds4drv-0.5.1-py3.8.egg/ds4drv/device.py", line 160, in control
[ds4_driver_node.py-18]   File "/usr/local/lib/python3.8/dist-packages/ds4drv-0.5.1-py3.8.egg/ds4drv/backends/hidraw.py", line 67, in write_report
[ds4_driver_node.py-18] OSError: [Errno 5] Input/output error
[ds4_driver_node.py-23] Exception in thread Thread-2:
[ds4_driver_node.py-23] Traceback (most recent call last):
[ds4_driver_node.py-23]   File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
[ds4_driver_node.py-23]     self.run()
[ds4_driver_node.py-23]   File "/usr/lib/python3.8/threading.py", line 870, in run
[ds4_driver_node.py-23]     self._target(*self._args, **self._kwargs)
[ds4_driver_node.py-23]   File "/karelics_workspace/karelics_brain/package_ws/install/rclpy/lib/python3.8/site-packages/rclpy/__init__.py", line 191, in spin
[ds4_driver_node.py-23]     executor.spin_once()
[ds4_driver_node.py-23]   File "/karelics_workspace/karelics_brain/package_ws/install/rclpy/lib/python3.8/site-packages/rclpy/executors.py", line 714, in spin_once
[ds4_driver_node.py-23]     raise handler.exception()
[ds4_driver_node.py-23]   File "/karelics_workspace/karelics_brain/package_ws/install/rclpy/lib/python3.8/site-packages/rclpy/task.py", line 239, in __call__
[ds4_driver_node.py-23]     self._handler.send(None)
[ds4_driver_node.py-23]   File "/karelics_workspace/karelics_brain/package_ws/install/rclpy/lib/python3.8/site-packages/rclpy/executors.py", line 429, in handler
[ds4_driver_node.py-23]     await call_coroutine(entity, arg)
[ds4_driver_node.py-23]   File "/karelics_workspace/karelics_brain/package_ws/install/rclpy/lib/python3.8/site-packages/rclpy/executors.py", line 343, in _execute_timer
[ds4_driver_node.py-23]     await await_or_execute(tmr.callback)
[ds4_driver_node.py-23]   File "/karelics_workspace/karelics_brain/package_ws/install/rclpy/lib/python3.8/site-packages/rclpy/executors.py", line 118, in await_or_execute
[ds4_driver_node.py-23]     return callback(*args)
[ds4_driver_node.py-23]   File "/karelics_workspace/karelics_brain/package_ws/install/ds4_driver/lib/python3.8/site-packages/ds4_driver/controller_ros.py", line 127, in cb_stop_rumble
[ds4_driver_node.py-23]     self.control(rumble_small=0, rumble_big=0)
[ds4_driver_node.py-23]   File "/karelics_workspace/karelics_brain/package_ws/install/ds4_driver/lib/python3.8/site-packages/ds4_driver/controller.py", line 89, in control
[ds4_driver_node.py-23]     self._control()
[ds4_driver_node.py-23]   File "/karelics_workspace/karelics_brain/package_ws/install/ds4_driver/lib/python3.8/site-packages/ds4_driver/controller.py", line 95, in _control
[ds4_driver_node.py-23]     self.device.control(led_red=self._led[0],
[ds4_driver_node.py-23]   File "/usr/local/lib/python3.8/dist-packages/ds4drv-0.5.1-py3.8.egg/ds4drv/device.py", line 160, in control
[ds4_driver_node.py-23]   File "/usr/local/lib/python3.8/dist-packages/ds4drv-0.5.1-py3.8.egg/ds4drv/backends/hidraw.py", line 67, in write_report
[ds4_driver_node.py-23] OSError: [Errno 71] Protocol error

There are times when OSError: [Errno 108] Cannot send after transport endpoint shutdown is also thrown in those situations.
I believe that these should be properly handled because someone might want to send some commands to the controller right before or after it disconnects and that situation is quite hard to properly detect sometimes.
I will submit a pull request in which these are properly handled. Hope you will accept it! :)

This workspace contains non-catkin packages in it, and catkin cannot build a non-homogeneous workspace without isolation.

Hi
I am trying to install your driver so I can control my diff drive robot with a ps4 dual Shock 4 v2 controller.

I followed your instructions and when I cam to compile I get the following. I am new to ROS so excuse me if I am making some newbie mistakes

also I we can not get this working how do I reverse your commands so that I can make my original version?

regards

maxwell@maxwell-desktop:$ cd catkin_ws
maxwell@maxwell-desktop:
/catkin_ws$ catkin_make
Base path: /home/maxwell/catkin_ws
Source space: /home/maxwell/catkin_ws/src
Build space: /home/maxwell/catkin_ws/build
Devel space: /home/maxwell/catkin_ws/devel
Install space: /home/maxwell/catkin_ws/install

Running command: "make cmake_check_build_system" in "/home/maxwell/catkin_ws/build"

-- Using CATKIN_DEVEL_PREFIX: /home/maxwell/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/maxwell/catkin_ws/devel;/opt/ros/kinetic
-- This workspace overlays: /home/maxwell/catkin_ws/devel;/opt/ros/kinetic
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/maxwell/catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/gmock': gtests will be built
-- Found gmock sources under '/usr/src/gmock': gmock will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.29
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing 7 packages in topological order:
-- ~~ - teleop_twist_keyboard
-- ~~ - beginner_tutorials
-- ~~ - ds4_driver (plain cmake)
-- ~~ - practical_sensors
-- ~~ - rplidar_ros
-- ~~ - practical_localization
-- ~~ - practical_nav
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkin_workspace.cmake:100 (message):
This workspace contains non-catkin packages in it, and catkin cannot build
a non-homogeneous workspace without isolation. Try the
'catkin_make_isolated' command instead.
Call Stack (most recent call first):
CMakeLists.txt:69 (catkin_workspace)

-- Configuring incomplete, errors occurred!
See also "/home/maxwell/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/maxwell/catkin_ws/build/CMakeFiles/CMakeError.log".
Makefile:1186: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed
maxwell@maxwell-desktop:~/catkin_ws$

Can't connect via bluetooth

Faced a problem - I can’t connect the joystick using bluetooth. I run
roslaunch ds4_driver ds4_driver.launch
before uncommenting line 8 in the file ds4_driver/config/params:
backend: bluetooth

  1. I' run 'roslaunch ds4_driver ds4_driver.launch'
  2. Pressed "Share"+"PS" buttons on my dualshock controller
  3. He start blinking, and after half minute evrething crash

Here is what I get:

roslaunch ds4_driver ds4_driver.launch 
... logging to /home/edward/.ros/log/9af95c0e-1a73-11ea-a4bf-98ded01d76cb/roslaunch-edward-6670.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://192.168.102.86:33101/

SUMMARY
========

PARAMETERS
 * /ds4_driver/deadzone: 0.1
 * /ds4_driver/device_addr: 
 * /ds4_driver/pub_joy_on_change: True
 * /ds4_driver/use_standard_msgs: False
 * /rosdistro: melodic
 * /rosversion: 1.14.3

NODES
  /
    ds4_driver (ds4_driver/ds4_driver_node.py)
    ds4_to_imu (tf2_ros/static_transform_publisher)

ROS_MASTER_URI=http://192.168.102.86:11311

process[ds4_driver-1]: started with pid [6685]
process[ds4_to_imu-2]: started with pid [6686]
[INFO] [1575895880.484337]: [bluetooth]: Scanning for devices
Traceback (most recent call last):
  File "/home/edward/assisstant_ws/src/ds4_driver/nodes/ds4_driver_node.py", line 64, in <module>
    main()
  File "/home/edward/assisstant_ws/src/ds4_driver/nodes/ds4_driver_node.py", line 52, in main
    for device in backend.devices:
  File "/usr/local/lib/python2.7/dist-packages/ds4drv/backends/bluetooth.py", line 132, in devices
    device = self.find_device()
  File "/usr/local/lib/python2.7/dist-packages/ds4drv/backends/bluetooth.py", line 120, in find_device
    self.logger.info("Found device {0}", bdaddr)
  File "/home/edward/assisstant_ws/src/ds4_driver/src/ds4_driver/logger.py", line 22, in info
    rospy.loginfo(msg, *args)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/core.py", line 194, in loginfo
    _base_logger(msg, *args, logger_level='info', **kwargs)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/core.py", line 187, in _base_logger
    logfunc(msg, *args)
  File "/usr/lib/python2.7/logging/__init__.py", line 1174, in info
    self._log(INFO, msg, args, **kwargs)
  File "/usr/lib/python2.7/logging/__init__.py", line 1293, in _log
    self.handle(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 1303, in handle
    self.callHandlers(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 1343, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 766, in handle
    self.emit(record)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rosgraph/roslogging.py", line 239, in emit
    record_message = _defaultFormatter.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 465, in format
    record.message = record.getMessage()
  File "/usr/lib/python2.7/logging/__init__.py", line 329, in getMessage
    msg = msg % self.args
TypeError: not all arguments converted during string formatting
[ds4_driver-1] process has died [pid 6685, exit code 1, cmd /home/edward/assisstant_ws/src/ds4_driver/nodes/ds4_driver_node.py __name:=ds4_driver __log:=/home/edward/.ros/log/9af95c0e-1a73-11ea-a4bf-98ded01d76cb/ds4_driver-1.log].
log file: /home/edward/.ros/log/9af95c0e-1a73-11ea-a4bf-98ded01d76cb/ds4_driver-1*.log

In general, I want to use the joystick in a docker container. At the same time, when I launch just a driver, it finds a joystick (both in the container and on the host machine):
ds4drv

[info][controller 1] Created devices /dev/input/js0 (joystick) /dev/input/event2 (evdev) 
[info][bluetooth] Scanning for devices
[info][bluetooth] Found device 00:1F:E2:DC:A8:02
[info][controller 1] Connected to Bluetooth Controller (00:1F:E2:DC:A8:02)
[info][bluetooth] Scanning for devices
[info][controller 1] Battery: Fully charged
[warning][controller 1] Signal strength is low (38 reports/s)

Maybe controller.py dont create device in /dev/input ?

I will be grateful for any ideas what could be the problem.

Cannot reconnect after returning from suspend

ds4_driver_node seems to terminate from exception after coming back from suspend.

Exception in thread Thread-5:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/home/naoki/ros/workspaces/kinetic/common/src/ds4_driver/src/ds4_driver/controller.py", line 56, in run
    self.loop.run()
  File "build/bdist.linux-x86_64/egg/ds4drv/eventloop.py", line 102, in run
    for fd, event in self.epoll.poll(self.epoll_timeout):
IOError: [Errno 4] Interrupted system call

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.