I’m trying to use the LiDAR sensor and move the joints using ROS, without the stretch bot API. For example, I want the LiDAR sensor to detect an object and have the joints move in response. I am subscribing to the laser scan topic to use the LiDAR sensor and I’m moving the joints similar to the demos in the stretch bot github.
Currently, my code initializes two nodes (hm.HelloNode for the joints and another separate one for the LiDAR) but this is giving me errors. None of the examples show how to use both the LiDAR and joints in one script. Is there other sample code available for this / has anyone been able to do this?
Hey @evarsh, Wellcome to the stretch community.
Yes, moving the robot joints with the LiDAR input from a single Node is very doable. You are right; you will have to utilize the hm.HelloNode class object in your Node to move the stretch robot joints using ROS, and you will have to subscribe to the “/scan” topic within your Node.
Also, make sure you have the “stretch_driver” node and “lidar_node” running, which can be launched by including the launch files stretch_driver.launch and rplidar.launch from the stretch_core package to your main launch file. You can use this example launch file as a template.
For scripting your ROS nodes with stretch, we have stretch_ros_tutorials available from which you can find various stretch ROS node snippets with explanations. In addition, I would recommend you go through this Follow Joint Trajectory Tutorial and Laser Scan Filter Tutorial for your project before you start writing your Node.
I hope the resources I have mentioned above will be helpful for your project.