Discussion - Ros2_Control Overview & Simulation (Making a Mobile Robot Pt 12)

Main video

Extra video

Main video blog post
Extra video blog post

This is the discussion topic for the video and blog post linked above. Please keep all replies relevant to the content, otherwise create a new topic.

Hi Josh just watched the videos you posted dropped for module number 12. I’m getting really excited as I see all of this coming together. I’ve been collecting the bits and pieces to build my own set up and follow your tutorials.

My question has to do with the physical hardware controller that you used it looks like it’s a gaming controller of some kind. I’m not very familiar as I don’t have a gaming system or play one.

I realize that ultimately I could use most any gaming controller if I wanna just write my own inner face but for the moment I just wanna duplicate what you’ve done and then branch off on my own

Do you have any thoughts or recommendations on a particular one to buy and start with So I can use the exact configuration you are using?

Hey Eric, I’ll be diving deeper into that in 2 videos time, but here’s a few quick points :slight_smile: :

  • I’m using an old wired (USB) Xbox 360 controller
  • There are generally 3 types of controllers: USB wired, Bluetooth, and wireless with a USB dongle
    • Wireless is obviously nicer, and means you can connect to either the robot or a development machine on the network, whereas wired kind of restricts you to the latter
    • I don’t trust Bluetooth reliability, especially on Linux and on the Pi, so I prefer USB-based options, but many people do have success with Bluetooth (PlayStation controllers being a classic for this). It’s also more annoying to re-pair etc.
  • Depending on the controller you may or may not need Linux drivers for it (just as if you were playing a game with it). In my limited experience, USB wired ones usually work with no extra software or issues, wireless/Bluetooth can be trickier.
  • Once the OS sees it as a “joystick” they are all pretty much the same as far as ROS is concerned. We use joy/joy_node to read the raw joystick data from the OS and publish it to /joy.
  • Now that the joystick input is available as a ROS topic we can do whatever we want with it. For our differential drive robot, we use teleop_twist_joy to take those axis/button press measurements from /joy and convert them to a Twist message on /cmd_vel. The axis/button numbering will be different for different controllers, you just have to set the parameters accordingly (e.g. axis 1 is forward/reverse, axis 2 is left/right, button 4 is enable).
  • So with all that being said pretty much any controller/joystick/gamepad will work. I personally just like the ergonomics of the Xbox controllers, and I’ll see if I can get my wireless one (Xbox One S version w/ Bluetooth) going for the video, otherwise I usually just plug the wired one into a laptop and carry it around.
  • In the video I’ll also briefly cover connecting a gamepad to your phone, and then connecting the phone to ROS. For that I’ll be using this Bluetooth phone gamepad, but I’d be hesitant to recommend it as I found the joystick deadzones too jarring.
  • Thanks for prompting me to think about this. I’ve just ordered this one (eBay Australia link) as it seems like it might be a fairly common, cheap one, so hopefully it works ok and I can recommend it in future.

Hope that helps!

Josh, thank you. Helpful information. I just purchased the same controller for $13 USD, so I can test what you are doing. I think it is helpful when you post links to what parts you are using so others can follow-along.

-Eric

1 Like

Josh, I’ve been thinking about an idea for a future tutorial for you, related to robot control. It’s one I would really like to see.

Once you have the ROS2 Control working with your joystick/game controller, I would like to see you add a control node using an Arduino., LCD shield, a few buttons and potentiometers. This would help us see how your Arduino node would do for I/O, say on a custom portable control pendant. Here’s what I have in mind:

INPUTS
2 buttons - Honk Remote buzzer or flash LED headlights.
3 potentiometers - speed control, throttle (and, ideally, steering, perhaps using a dual pot joystick but I understand that is more involved).

OUTPUTS
Buzzer - when a bump switch on robot is activated it should trigger this buzzer/light/whatever
LCD - One line for Speed and heading (relative to anything you can grab); One line for angle of something, like the wheels; and One line for distance to object – whatever is in front.

What I am really keen to learn is how you would plan this and do the interface to both broadcast and listen to the appropriate pins/signals.

The concepts you develop here, perhaps with input from the community, would allow us to make custom controllers with bidirectional capabilities.

If you do not have an LCD shield, I would be happy to make a contribution to cover one.

I would really like to see this in a future video.

Thanks for all you do to teach and guide us.

Eric

Update: If the above is a task that is better suited for a Raspberry Pi, that is OK. If so, I would like to understand why (e.g. software, IO, libraries, etc. If Raspberry PI, could we use a PICO W with an I2C Shield or something?). This is what I think an excellent concept that people [like me] could run with once they an understanding of how to approach this. Thanks for considering.

Hey Eric, interesting idea!
Are you imagining something like the ones James Bruton has made for his videos?
He’s had a few different ones (at least 3), but the “old one” shown at the start of this video seems to be what you’re describing.

I had not considered it, but that’s not a bad idea, I will give it further thought. I’d probably be leaning toward the Pico W (as you’ve suggested) and programming it with micro-ROS or CircuitPython, but those decisions would mostly be driven by me having never used those platforms before and it seems like a good starter project to get my feet wet.

Yes! I had forgotten about his video. I’ve had the idea in the back of my mind for too many years, but the missing link was the software. You are convincing me that ROS2 is the way to go.

Please do consider the basic proposal in one of your upcoming videos. Happy to help brainstorm.

UPDATE: I just watched the video again. I like his idea of using a touch screen for more virtual buttons. Might be cool someday to touch a map of the room and the robot goes there. Then a PTZ Camera on the robot can beam video back. He uses an Arduino to manage the I/O and send/receive commands via Serial to USB into the Pi, which runs the ROS node. Source code in his github but I think it may be ROS not ROS2.

Hi Josh,

Thanks for share this ros2 control video it is very helpful.
I am getting this error while running “ros2 launch my_bot launch_sim.launch.py”. If you have any suggestions to resolve this issue. kindly pleas share it with me.

[gzserver-2] [ERROR] [1669334236.428722199] [gazebo_ros2_control]: parser error Couldn’t parse params file: ‘–params-file /home/niranjan/dev_ws/install/my_bot/share/my_bot/config/my_control_params.yaml’. Error: Cannot have a value before ros__parameters at line 4, at /tmp/binarydeb/ros-foxy-rcl-yaml-param-parser-1.1.14/src/parse.c:623, at /tmp/binarydeb/ros-foxy-rcl-1.1.14/src/rcl/arguments.c:388

Thanks
Niranjan

Hi Josh,

I think I am able to resolve this issue. It looks like the my_controls.yml parameter file ros__parameters requires two underscore I had a typo here. After fixing the typo the issue got resolved.

Thanks
Niranjan

Glad you were able to get it fixed!
And yes that double underscore is an easy mistake to make, I’ve definitely tripped on that before!

1 Like