ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Balancing Two-Wheeled Robot in ROS2-Foxy

asked 2021-05-01 09:32:16 -0600

ferro gravatar image

Hi , I am new in ros2 and i am trying to do a two wheeled self-balancing robot by using ros2 and gazebo. However, i have some problem with self-balancing part of robot. Could someone give some direction ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-05-11 16:04:19 -0600

highmax1234 gravatar image

updated 2021-05-11 16:06:01 -0600

You will need a controller and a gazebo plugin. The controller can be either within the plugin or separate in a ros2 node, which is what you should prefer in case you ever want to build the robot in reality.

You can find examples on gazebo plugins in this repo:

The input to your controller will probably be an IMU that can give you the pitch angle of the middle part of the robot. The controller will need to be cascaded.

  • You can control the speed of the robot by setting its acceleration.
  • You can control the acceleration of the robot by setting the pitch angle of the robot.
  • You can control the pitch angle of the robot my using force in the opposite direction on the wheels.
edit flag offensive delete link more


Adding onto this post, I found it helpful to look through these links:

  • A ROS1 differential drive node created by Jon Stephan, there's a nice picture: differential_drive

  • The Nav2 system for ROS2, again, very nice picture: Nav2

  • ROS2 Foxy tutorials: Tutorials Index

I can't speak about Gazebo, but for your robot you will be looking to support a few bare-minimum messages:

Most of the ROS 1 and 2 stuff expects to receive TF2 & Odometry messages describing the robot's position, and to send your robot Twist via /cmd_vel

Spectre gravatar image Spectre  ( 2021-05-11 20:10:35 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2021-05-01 09:32:16 -0600

Seen: 246 times

Last updated: May 11 '21