Dave Has A New Grove UltraSonic Ranger!

Here is Dave sporting his new Grove Ultrasonic Ranger:


 

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.)

Have to build the ROS2 node for it next.

2 Likes

Wow, it seemed so easy, until I realized I have forgotten a few of the early steps.

Steps:

  1. mount and cable the sensor to AD2
  2. find the DI Grove_US.py example
  3. remember that the sensor is plugged into AD2 - duh! modify Grove_US.py
  4. create an easy_ultrasonic_sensor.py test program
  5. discover that someone left a debug print stmt in easysensors.py
  6. create a …/ros2_gopigo3_node/ultrasonic_ranger.py
  7. add ultrasonic_ranger:main to …/src/ros2_gopigo3_node/setup.py
  8. run my “buildit.sh” (debug the compile time errors in ultrasonic_ranger.py)
  9. create a run_ultrasonic_ranger.sh
    (can’t remember “ros2 run ros2_gopigo3_node ultrasonic_ranger” everytime)
  10. start up the ultrasonic_ranger node and debug runtime errors, rebuild, start, debug till good
  11. fire up the virtual ros desktop
  12. find the dave.urdf (nestled in handsonros2/src/chap4_rviz_basics/urdf/)
  13. Add the ultrasonic_ranger and joint_ultrasonic info to the URDF
  14. FORGOT about this step needed: build on the ROS desktop machine so URDF gets put where the robot_state_publisher will find it!
  15. On Dave: use run_ultrasonic_ranger.sh to start the ultrasonic ranger node
  16. On Dave: use runit.sh to start the gopigo3, LIDAR, Distance Sensor nodes
  17. On ROS Desktop: use launch_rviz2_joint_and_robot_pubs.sh to start up there
  18. Add a new Range_US plugin to the display, configure for /ultrasonic_ranger/range topic
  19. 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)
  1. push everything new up to github from Dave
  2. push everything new up to github from ROS Desktop
  3. Hurry and shutdown Dave - the battery is at 9.7v - less than four minutes till sudden death

and for tomorrow:

  1. 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
2 Likes

Simple! :slight_smile:

I see you are using .sh files to launch - is that because you don’t like the ROS2 python launch files?

/K

1 Like

For two reasons:

  1. I didn’t figure out how to use xml launch files in ROS2
    and
  2. it is easier to type the first letter and hit tab
    (./l gets "./launch_rviz2_with_joint_and_robot_pubs.sh)
    than to remember and type:
source ~/handsonros2/install/setup.bash
ros2 launch rviz2_basics ros2_dave_rviz2.launch.py

and I can remember “buildit.sh” (./b), “runit.sh” (./r), “killit.sh” (./k) years from now when I come back to a project.

1 Like

Finally got both DI Distance Sensor and Grove Ultrasonic Ranger to display:

1 Like

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 something like that.
/K

2 Likes

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 
1 Like

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.

2 Likes

How about that? 1 day and @cleoqc already committed the fix.

ModRobotics continues to impress me with great support for the GoPiGo3 robot!

2 Likes