Home | Tutorials | Wiki | Issues
Ask Your Question

How do you simulate a servo motor in Gazebo

asked 2015-04-12 19:57:15 -0500

Cerin gravatar image

updated 2015-04-12 19:58:25 -0500

Is there a guide or example for simulating a servo (specifically a Dynamixel-style servo that provides position feedback)? I know how to create a joint and apply a force to the joint, but I'm not sure how to control this as I would a servo motor, by simply specifying a position and then a plugin would intermittently apply force to keep the servo at that position. I suppose I could mock something up using Joint::GetAngle, but I don't want to reinvent the wheel.

edit retag flag offensive close merge delete


you can use a PID controller

djou07 gravatar imagedjou07 ( 2015-04-13 02:08:17 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2015-06-29 14:09:02 -0500

PML gravatar image

Im not sure if there is a tutorial but you can write a sensor plugin based from the ForceTorquePlugin that can be assigned to joints. If you download the gazebo code (in this case I am using version 5.0.1) you can find sample code of the ForceTorquePlugin inside the plugin folder, to get the position/angle you can use the parent sensor as in the following example:




Now you can apply a scaling factor to that value to correspond to the reading your servo should be providing and publish it to a topic with a message of type msgs::Joint.

edit flag offensive delete link more


Hi PML! can you please elaborate? I ran into the same issue: I need to simulate a servo but even after browsing for a while, I'm lost... thanks!

ellerenad gravatar imageellerenad ( 2015-11-13 01:09:24 -0500 )edit

answered 2015-04-13 11:43:29 -0500

nkoenig gravatar image

As you suggested, you'll have to write a plugin to model the behavior of a specific servo.

edit flag offensive delete link more



Is there any tutorial or example plugin I can reference?

Cerin gravatar imageCerin ( 2015-04-29 19:39:49 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2015-04-12 19:57:15 -0500

Seen: 2,011 times

Last updated: Jun 29 '15