ds4_driver package from ds4_driver repo

ds4_driver ds4_driver_msgs

Package Summary

Tags No category tags.
Version 0.2.1
License MIT
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/naoki-mizuno/ds4_driver.git
VCS Type git
VCS Version humble-devel
Last Updated 2023-02-28
Dev Status MAINTAINED
CI status No Continuous Integration
Released UNRELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

ROS driver for the DualShock 4 controller

Additional Links

Maintainers

  • Naoki Mizuno

Authors

  • Naoki Mizuno
README
No README found. See repository README.
CHANGELOG
No CHANGELOG found.

Wiki Tutorials

See ROS Wiki Tutorials for more details.

Source Tutorials

Not currently indexed.

Launch files

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged ds4_driver at answers.ros.org

No version for distro iron. Known supported distros are highlighted in the buttons above.
No version for distro rolling. Known supported distros are highlighted in the buttons above.

ds4_driver package from ds4_driver repo

ds4_driver

Package Summary

Tags No category tags.
Version 0.2.1
License MIT
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/naoki-mizuno/ds4_driver.git
VCS Type git
VCS Version noetic-devel
Last Updated 2023-01-27
Dev Status MAINTAINED
CI status No Continuous Integration
Released UNRELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

ROS driver for the DualShock 4 controller

Additional Links

Maintainers

  • Naoki Mizuno

Authors

  • Naoki Mizuno

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

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.8/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,

$ roslaunch ds4_driver ds4_driver.launch
# Or
$ rosrun ds4_driver ds4_driver_node.py

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}=""

Demonstration

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

$ roslaunch ds4_driver demo.launch

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.

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/Status): current state of the device.

Subscribed

  • /set_feedback (ds4_driver/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/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/Status): joypad state.

License

MIT

Author

Naoki Mizuno (naoki.mizuno.256@gmail.com)

CHANGELOG
No CHANGELOG found.

Wiki Tutorials

See ROS Wiki Tutorials for more details.

Source Tutorials

Not currently indexed.

Package Dependencies

System Dependencies

No direct system dependencies.

Dependant Packages

No known dependants.

Launch files

Services

No service files found

Plugins

No plugins found.

Recent questions tagged ds4_driver at answers.ros.org

No version for distro ardent. Known supported distros are highlighted in the buttons above.
No version for distro bouncy. Known supported distros are highlighted in the buttons above.
No version for distro crystal. Known supported distros are highlighted in the buttons above.
No version for distro eloquent. Known supported distros are highlighted in the buttons above.
No version for distro dashing. Known supported distros are highlighted in the buttons above.
No version for distro galactic. Known supported distros are highlighted in the buttons above.

ds4_driver package from ds4_driver repo

ds4_driver

Package Summary

Tags No category tags.
Version 0.2.1
License MIT
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/naoki-mizuno/ds4_driver.git
VCS Type git
VCS Version foxy-devel
Last Updated 2023-01-27
Dev Status MAINTAINED
CI status No Continuous Integration
Released UNRELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

ROS driver for the DualShock 4 controller

Additional Links

Maintainers

  • Naoki Mizuno

Authors

  • Naoki Mizuno

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.8/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/Status): current state of the device.

Subscribed

  • /set_feedback (ds4_driver/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/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/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 (naoki.mizuno.256@gmail.com)

CHANGELOG
No CHANGELOG found.

Wiki Tutorials

See ROS Wiki Tutorials for more details.

Source Tutorials

Not currently indexed.

Launch files

Services

No service files found

Plugins

No plugins found.

Recent questions tagged ds4_driver at answers.ros.org

No version for distro lunar. Known supported distros are highlighted in the buttons above.
No version for distro jade. Known supported distros are highlighted in the buttons above.
No version for distro indigo. Known supported distros are highlighted in the buttons above.
No version for distro hydro. Known supported distros are highlighted in the buttons above.
No version for distro kinetic. Known supported distros are highlighted in the buttons above.
No version for distro melodic. Known supported distros are highlighted in the buttons above.