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

How to drive robot in opposite direction

asked 2017-04-28 04:59:03 -0600

mcarr gravatar image

updated 2017-04-28 05:12:56 -0600

Hi all,

I have a robotic research platform with caster wheels on the front and drive wheels at the back. At the moment it's driving with caster wheels at the front but I feel the dynamics could be improved by driving with the caster wheels at the back.

I have been thinking of different ways to accomplish this:

  1. Put a negative infront of motor control commands. This approach is on the lowest level. I am controlling the motors via an Arduino and putting a negative infront of motor control signals could accomplish the behaviour I desire. However the problem is that the frames such as base_link won't know the robot is moving in the other direction so control commands will all be reversed. Thus navigation will stop working.
  2. Change orientation of base_link frame. I tried doing this already but it didn't work, the robot simply drove in the casters-forward direction. My thought was that by changing the direction of base_link all commands would 'trickle down'. So the robot would take forwards at the casters-back direction and the footprint and move_base functionality should remain.

As I mentioned, I haven't has success in these approaches so would love to hear if anyone has ideas on how to make the robot consider the typically 'backwards' direction as forwards.


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-04-28 13:21:55 -0600

billy gravatar image

If you reverse the motor commands, the motors will drive backwards but the ODOM will also report backward and ROS will be very confused.

You'll need to accommodate the motor commands and ODOM reporting, as well as adjust your transforms and robot shape parameters to account for the new 'shape' of the robot.

Your laser scanner will now be pointed backward (if there is one) so your laser_baselink transform needs to be updated and any other sensors will need new transforms as well. Left became right and forward is now backwards, etc.

I couldn't open the link to see the robot so making some assumptions about the sensors included.

edit flag offensive delete link more


Great, thanks. I agree that it will probably require quite a few changes (I was hoping it would be one simple transformation). Need to change:

  • Motor commands in my Arduino motor driving code
  • Rotate base_link frame 180 degrees w.r.t. odom frame
  • Rotate laser frame 180 deg
mcarr gravatar image mcarr  ( 2017-05-02 04:15:11 -0600 )edit

Assuming your robot shape currently is setup so the center of rotation is at 0,0, you also need to update the shape parameters. The casters used to stick out the front, now they stick out the back. The change could cause unneeded collisions in tight spaces.

billy gravatar image billy  ( 2017-05-05 00:06:31 -0600 )edit

answered 2017-05-09 07:00:11 -0600

mcarr gravatar image

Will answer this myself because it solved the issue in a simpler manner.

Putting a negative infront on the motor commands doesnt work as it confuses the system. i.e. when we give a forward command, odom reports backwards.

The simplest way to achieve a change in robot direction is to swap the positive and negative pins supplying current to the motors. The ROS system has no idea that anything has been changed so all cmd_vel commands and tf frames work as desired still. The only required changed is the footprint of the robot.

edit flag offensive delete link more


Another way I achieved this was within the configuration of move_base. In the file base_local_planner_params.yaml I set max_vel_x = 0 and min_vel_x = 0.36 (robots max velocity is either direction). I'm using dwa_local_planner. If you're using base_local_planner, params will be different

mcarr gravatar image mcarr  ( 2017-05-17 06:56:50 -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: 2017-04-28 04:59:03 -0600

Seen: 1,355 times

Last updated: May 09 '17