Ask Your Question
0

simple robot integration with Gazebo to test all my robot code

asked 2014-04-07 11:19:09 -0500

I have built a simple chassis with left and right wheels with two separate motor controllers. The motor controllers are on a simple CAN communications bus. I've written an ROS service that sends the appropriate CAN messages to command each motor to any velocity it is capable of. I call that service from an ROS node that is subscribed to the standard geometry /cmd_vel Twist type message, which can be published by the example turtlebot-tele-op node or from the RQT plugin Robot Steering.

This is sort of the chain of events: Robot Steering -> [Twist Messages] -> Locomotion Node -> [API Messages] -> Motor API Service -> [CAN frames] -> Motor Controllers -> [current, amps] -> Motors

So I've done all this and it works fine, but I still feel like a newbie because I cannot figure out how to run all my software in Gazebo. Sure it's running on real hardware, but I'd like to add complexity and I want to test that complexity in simulation before running it on real hardware.

So I've used this ROS/Gazebo Integration Differential Drive tutorial ( http://gazebosim.org/wiki/Tutorials/1... ) to attach a differential drive plugin to a simple two wheeled and caster simulated robot in Gazebo and it allows me to drive the robot around the sim from the Robot Steering rqt plugin which publishes the Twist messages. This is great, but it only executes the Robot Steering rqt plugin to publish the Twist message and then it subscribes to that Twist message and none of the other software is used. So this scenario does not test my Locomotion Node nor my Motor API Service software that I wrote.

So my question is: Am I somehow able and does it make any sense to break the chain of events above at the CAN frames link and simulate just the motor controllers and the motors in the Gazebo sim so I can test the execution of the Robot Steering, Locomotion Node, and Motor API Service? I don't see any Gazebo nor ROS tutorials that show me a means to simulate down at this level of hardware, but maybe I'm just missing something fundamental because I'm so new to this domain.

Will I have to write my own layer of software to simulate the motor controllers and motors to Gazebo? Is there a plugin that I can use that operates at this level, rather than at the Twist Message level?

Thanks in advance for any help or advice you can give.

Kurt

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-04-07 14:30:16 -0500

jbinney gravatar image

updated 2014-04-07 14:31:35 -0500

Most ROS nodes (the nav stack, most teleop nodes, etc) assume that you use twist messages to control the base. Twists are general enough to describe almost any base motion, and usually we're using gazebo to debug higher level problems. If you get lower level than that, you might start having to tweak gazebo quite a bit to get friction coefficients correct, get inertia matrices just right, etc.

That being said, if you want to do simulation of the individual wheels, it shouldn't be too hard to modify the diff drive plugin to do what you want. Start with this file: https://github.com/ros-simulation/gaz...

Overview of the changes you'll need to make: * subscribe to your CAN API messages instead of the cmd_vel on line 227 * modify the cmdVelCallback to be canMsgCallback and to expect the right messages * modify UpdateChild() to apply the individual wheel velocities to the left and right wheels

edit flag offensive delete link more

Comments

Thanks for the advise! Maybe I will use the Twist for certain level of software testing and only dive down to the lower level to test a small portion of my code.

Kurt Leucht gravatar image Kurt Leucht  ( 2014-04-09 03:44:50 -0500 )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

1 follower

Stats

Asked: 2014-04-07 11:19:09 -0500

Seen: 1,900 times

Last updated: Apr 07 '14