Home | Tutorials | Wiki | Issues
Ask Your Question
1

How do you simulate a servo motor in Gazebo

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

Cerin gravatar image

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

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

Comments

you can use a PID controller

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

2 Answers

Sort by ยป oldest newest most voted
0

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

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:

this->parentSensor->GetJoint()->GetAngle(1).Degree()

or

this->parentSensor->GetJoint()->GetAngle(1).Radian()

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

Comments

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 -0600 )edit
0

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

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

Comments

1

Is there any tutorial or example plugin I can reference?

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

Question Tools

Stats

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

Seen: 1,837 times

Last updated: Jun 29 '15