Joystick Remote Control for HADA H500 Sprayer CANBUS-Based Protocol and Software Stack Interface to ROS
This ROS package was tested under ROS 1 Melodic installed on Ubuntu 18.04 and Joytron MXSwitch Bluetooth Joystick version was used to test the functionality. Other joystick brand and version may need adjustment.
- [v] add functionality to check joystick connection on (cansend_generator.py) for safety
- [v] add block to give understanding this node controlled by joystick or external
- [v] rewrite joy_detect.py
- improving detection speed on joy_detect.py
- [v] add block to indicate joystick on standby state which indicate by there is no incoming message on axis
- [v] combining ('/joystick_control_state') to joy_connection_status
- [v] create connection between joy_detect.py <-> rosrun ackermann_drive_teleop joyop.py
-
Build from source Joystick Remapper ROS Package
- Create new ROS workspace environment (recommended) for ROS Melodic. For ROS Noetic may need to modify the python script on joystick_remapper/script/joystick_remapper.py to python3.
mkdir -p ~/github/joystick_remapper_ws/src cd ~/github/joystick_remapper_ws catkin_make cd src git clone https://github.com/epan-utbm/joystick_remapper.git cd .. catkin_make source ~/github/joystick_remapper_ws/devel/setup.bash echo "source ~/github/joystick_remapper_ws/devel/setup.bash" >> ~/.bashrc source ~/.bashrc
- Create new file on directory joystick_remapper/launch with a name "joystick_remapper_ps3_hadarobot.launch" as an example.
After completed this step you will see new file called joystick_remapper_ps3_hadarobot.launch
cd ~/github/joystick_remapper_ws/src/joystick_remapper/launch touch joystick_remapper_ps3_hadarobot.launch
- Edit joystick_remapper_ps3_hadarobot.launch using Visual Studio Code and then copy this launch script below:
<?xml version="1.0"?> <launch> <node pkg="joy" type="joy_node" name="ps3_joy" > <remap from="joy" to="ps3_joy" /> <param name="dev" value="/dev/input/js0" /> <param name="deadzone" value="0.1" /> <param name="autorepeat_rate" value="10" /> </node> <node pkg="joystick_remapper" type="joystick_remapper.py" name="ps3_to_hadarobot" > <remap from="joy_source" to="ps3_joy" /> <remap from="joy_dest" to="joy" /> <param name="button_mapping" type="str" value="=" /> <param name="axis_mapping" type="str" value="0 3 1 2 4 5 6" /> <!-- result1 = 0 2 1 3 4 5 6--> </node> </launch>
-
Build from source HADA bringup ROS Package
Recommended steps. Assumed that github directory already available.
cd ~/github mkdir -p hada_bringup_ws/src catkin_make cd src git clone git@github.com:ditodamaru/hada_bringup.git cd .. catkin_make source ~/github/hada_bringup_ws/devel/setup.bash echo "source ~/github/hada_bringup_ws/devel/setup.bash" >> ~/.bashrc source ~/.bashrc
-
Build from source Ackerman Drive Message Generator Package
Recommended steps. Assumed that github directory already exist.
cd ~/github mkdir -p ackerman_teleop_ws/src catkin_make cd src git clone -b melodic-devel git@github.com:ditodamaru/ackermann-drive-teleop.git cd .. catkin_make source ~/github/ackerman_teleop_ws/devel/setup.bash echo "source ~/github/ackerman_teleop_ws/devel/setup.bash" >> ~/.bashrc source ~/.bashrc
-
Build from source this repository
Recommended steps. Assumed that github directory already exist
cd ~/github mkdir -p hadacan_ros_ws/src catkin_make cd src git clone git@github.com:ditodamaru/hadacan_ros.git cd .. catkin_make source ~/github/hadacan_ros_ws/devel/setup.bash echo "source ~/github/hadacan_ros_ws/devel/setup.bash" >> ~/.bashrc source ~/.bashrc
-
Launch ROS Nodes
- Terminal 1: Start bluetooth joystick node and joystick topic remapper
roslaunch joystick_remapper joystick_remapper_ps3_hadarobot.launch
- Terminal 2: Start joystick controller safety node
rosrun cansend_generator joy_detect.py
-
Terminal 3: Start CAN Bus Communication with HADA H500 Robot
For first installation
rosrun hada_bringup setup_can2usb_hada.bash
After installation finished, directly use this steps below.
Terminal 3: Option 1
rosrun hada_bringup bringup_can2usb_hada.bash
Option 2 (Optionally to start CAN Bus communication could be done by this command without hada_bringup package)
sudo ip link set can0 up type can bitrate 125000
Terminal 4: Troubleshooting CAN Bus communication (You will see incoming CAN frame messages from HADA H500 robot)
candump can0
-
Terminal 5: Start ackerman drive steering control node
rosrun ackermann_drive_teleop joyop.py
- Terminal 6: Start sending CAN frame message to H500 Sprayer.
CAUTION: Make sure to move the HADA H500 sprayer robot in a safe space.
rosrun cansend_generator cansend_generator.py
- Check this video for details
- Check this figure for troubleshooting
- Check this figure below for troubleshooting
This guideline is intended to make integration between basic usage mentioned above and real-time robot position visualization purpose in RVIZ, also to do mininum requirement for making Visual SLAM (VSLAM) working based on RTABMap for Handheld Mapping.
-
Make sure to succesfully build from source hada_explorer_ws package
-
Launch ROS Nodes
- Terminal 7: Start visualize the H500 Sprayer in RVIZ
- a. (Make sure you have similar H500 URDF xacro file equpped with RealSense D435i and GPS).
- b. And then copy and modify this launch file according to your URDF file setting. IMPORTANT Make sure to change the position of gps_link and camera_link to base_link according to your depth camera position setting in reality. So this URDF file basically acting as a twin of your real robot.
- c. (This command below is just an example if you want to test and learn about the H500 URDF xacro file equpped with RealSense D435i and GPS).
- d. This RVIZ visualization will automatically subscribe to odometry message which will represent the robot movement in reality. How to get odometry message if the robot doesn't have any odometry message? Read more here which explain RTABMap setting in order to get odometry via RTABMap stereo mode.
roslaunch hada_explorer_description hada_base_bringup_method2.launch
- After above command executed, try to learn about TF (transform) tree of this H500 URDF xacro file with this command
rosrun rqt_tf_tree rqt_tf_tree
- Terminal 8: Start the DepthAI OAK-D RGB-D Mode for Handheld Mapping: Read more about RGB-D Handheld Mapping for OAK-D camera here
roslaunch depthai_examples stereo_inertial_node.launch
- Terminal 9: Start to estimate quaternion of the IMU data
rosrun imu_filter_madgwick imu_filter_node \
imu/data_raw:=/stereo_inertial_publisher/imu \
imu/data:=/stereo_inertial_publisher/imu/data \
_use_mag:=false \
_publish_tf:=false
- Terminal 10: Start Mapping Mode
roslaunch rtabmap_launch rtabmap.launch \
args:="--delete_db_on_start" \
rgb_topic:=/stereo_inertial_publisher/color/image \
depth_topic:=/stereo_inertial_publisher/stereo/depth \
camera_info_topic:=/stereo_inertial_publisher/color/camera_info \
imu_topic:=/stereo_inertial_publisher/imu/data \
frame_id:=oak-d_frame \
approx_sync:=true \
wait_imu_to_init:=true
- Terminal 11: Start Localization Mode
- After the mapping process completed, then switch to localization mode or switch back to mapping mode if you are not satisfy with the map result.
rosservice call rtabmap/set_mode_localization
rosservice call rtabmap/set_mode_mapping
Read more in Stereo Outdoor Navigation tutorial
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Contributors names and contact info