ROS package to read PS4 DualShock controller that uses a Sub-GHz LPWA 920MHz wireless module that enables long-distance communication (IM920sL Interplan with XIAO-RP2040 board from Seeed Studio). This takes naoki-mizumi/ds4_driver as message reference.
- Clone this project to your catkin's workspace src folder.
cd ~/<catkin-workspace>/src
git clone https://github.com/syahrulirwansyah12/ps4msd.git -b devel
- Run catkin_make in your workspace folder.
cd ~/<catkin-workspace> && catkin_make
- In case you haven't installed pyserial yet, please install it first.
pip install pyserial
or
pip3 install pyserial
if you're using Python3.
- Check the authority of XIAO-RP2040's serial-port:
ls -l /dev/ttyACM*
- Add the authority of write: (such as /dev/ttyACM0):
sudo chmod 666 /dev/ttyACM0
- You can set the permission permanently by creating a udev rule.
cd /etc/udev/rules.d/
sudo touch local.rules
then add:
ACTION=="add", KERNEL=="/dev/ttyACM0", MODE="0666"
to the file you have been made.
- After setting up the serial port you can run the node by running roscore then rosrun:
roscore
rosrun ps4msd ps4msd_node.py
- Published Topics
/joystick/joystate
(ps4msd/Joystate)
publishes topics from the joystick state
/joystick/cmd_vel
(geometry_msgs/Twist)
publishes topic of command velocity from the right analog hat - Parameters
serial_port
serial port name used in your system. (string
, default:/dev/ttyACM0
)
baudrate
serial port baud rate. (int
, default:115200
)
max_speed
maximum linear speed in m/s. (float
, default:0.4
)
max_turn
maximum angular speed in rad/s. (float
, default:0.8
)