Comparing accuracy (1cm) and max range to the V53L0X Time-of-Flight Distance Sensor, the ultrasonic sensor is a real weakling, BUT black objects are no longer invisible! (At $4 it can’t be beat.)
With Dave having LIDAR, the ToF Distance Sensor is totally redundant. (Carl was heard whispering he already has several ideas for it.)
Wow, it seemed so easy, until I realized I have forgotten a few of the early steps.
Steps:
mount and cable the sensor to AD2
find the DI Grove_US.py example
remember that the sensor is plugged into AD2 - duh! modify Grove_US.py
create an easy_ultrasonic_sensor.py test program
discover that someone left a debug print stmt in easysensors.py
create a …/ros2_gopigo3_node/ultrasonic_ranger.py
add ultrasonic_ranger:main to …/src/ros2_gopigo3_node/setup.py
run my “buildit.sh” (debug the compile time errors in ultrasonic_ranger.py)
create a run_ultrasonic_ranger.sh
(can’t remember “ros2 run ros2_gopigo3_node ultrasonic_ranger” everytime)
start up the ultrasonic_ranger node and debug runtime errors, rebuild, start, debug till good
fire up the virtual ros desktop
find the dave.urdf (nestled in handsonros2/src/chap4_rviz_basics/urdf/)
Add the ultrasonic_ranger and joint_ultrasonic info to the URDF
FORGOT about this step needed: build on the ROS desktop machine so URDF gets put where the robot_state_publisher will find it!
On Dave: use run_ultrasonic_ranger.sh to start the ultrasonic ranger node
On Dave: use runit.sh to start the gopigo3, LIDAR, Distance Sensor nodes
On ROS Desktop: use launch_rviz2_joint_and_robot_pubs.sh to start up there
Add a new Range_US plugin to the display, configure for /ultrasonic_ranger/range topic
Debug “No transform from ultrasonic_ranger to odom”
research the urdf check tool because forgot that too: “check_urdf dave.urdf”
start and build and kill and start and build on Dave until remember have to build on the ROS Desktop - duh! return to forgotten step 14 and repeat 14) thru 18)
push everything new up to github from Dave
push everything new up to github from ROS Desktop
Hurry and shutdown Dave - the battery is at 9.7v - less than four minutes till sudden death
and for tomorrow:
Debug why my rviz2 will only show the DI Distance Sensor if I turn off the ultrasonic sensor display
p.s. Testing:
Grove Ultrasonic Ranger (2.0)
3-350 cm, 1 cm accuracy
15 deg beam width
8 mA at 5v
10 Hz is best
Test Distance - Reading: (Test Distances measured to +/- 2mm or so)
15mm = 15mm
50mm = 40mm
100 = 95
200 = 195
300 = 289
400 = 382
500 = 477
1000 = 985
1500 = 1500
Result: Errors -5 mm to -15 mm
Fair enough. So the shell program then launches the launch.py programs? I did just now notice that you do have the launch.py programs on your GitHub.
Looks great.
As I think about the different sensors with potentially redundant information, I’m reminded of the saying “The man with a watch always knows what time it is; the man with two watches is never sure.” Perhaps the follow on is “the robot with multiple sensors can do statistical weighting to improve their chance of having a correct reading”.
or the entry point listed in the gopigo3 node’s setup.py launch configuration ( gopigo3_node, the distance sensor and the ultrasonic sensor)
and
the launch files for the LIDAR and the gamepad.
(Interesting that the LIDAR launch also launches a tf2 static_transform. I don’t know how that plays with the robot_state_publisher and joint_state_publisher putting out a static transform from the URDF when they start up - I think they do that.)
runit.sh:
#!/bin/bash
cd ~/rosbot-on-gopigo3/handsonros2
. ~/rosbot-on-gopigo3/handsonros2/install/setup.bash
# ros2 run ros2_gopigo3_node gopigo3_node &
ros2 run ros2_gopigo3_node gopigo3_node --ros-args -p S1LPW:=2094 -p S1RPW:=750 -p S1SECTOR:=2.443 &
# ros2 run ros2_gopigo3_node gopigo3_node --ros-args --params-file ./src/ros2_gopigo3_node/gopigo3_node_params.yaml &
ros2 run ros2_gopigo3_node distance_sensor &
ros2 run ros2_gopigo3_node ultrasonic_ranger &
# start SNES gamepad node (cntrl-c to stop this script will kill it automagically)
ros2 launch teleop_twist_joy teleop-launch.py joy_config:="snes" &
# Don't know how to kill it by name, so don't run in background - use cntl-c
ros2 launch ydlidar_ros2_driver ydlidar_launch.py
Since Dave doesn’t have bumpers and I haven’t yet figured out if we can use get_motor_status() as a virtual bumper, I’ll be really happy if any one of the three sensors alert that there is something 6 to 8 inches in front of him. He needs 5.5 inches to turn 180 and run away.