Gazebo | Ignition | Community
Ask Your Question

How correctly move joints by SetPosition() ?

asked 2015-11-24 07:11:18 -0600

Ivanchik gravatar image

updated 2015-11-24 13:42:03 -0600

Hi there.

I am new in Gazebo, so I want time to time move joints in response to incoming signals from other software. It will be simple for me, if joint::SetPosition() works correctly, but I didn't find any implementation in source code and in docs.

I'd tried implement it by myself through SetVelocity() together with SetHighStop() and SetLowStop(), but it doesn't work for me now. In ODE SetPosition() works correctly. I use gazebo 4.1, dart 4.3, without ROS. Have someone any ideas how correctly use SetPosition() or replace this method and save SetPosition() functionality?

Best regards.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-01-06 11:57:05 -0600

debz gravatar image


I'm not 100% sure, but I think this function might use default PIDs to set joints positions. I think the proper way to do what you want is to use directly these PIDs (or yours):

// Get the default PIDs attached to your joints
this->jointController = this->model->GetJointController()  

// In a loop, on your joints
// Create a PID
gazebo::common::PID PID = gazebo::common::PID(p,i,d,imax,imin,cmdMax,cmdMin);
// Set the PID to your joint (pay attention to joint name and scopedName)
// Set target
this->jointController->SetPositionTarget((*it)->GetScopedName(), target);

// Update the controller

Here is the doc: https://osrf-distributions.s3.amazona...

edit flag offensive delete link more


I don't see the Setposition function anywhere in the code above... gravatar ( 2017-07-14 10:17:44 -0600 )edit

Question Tools



Asked: 2015-11-24 07:11:18 -0600

Seen: 2,397 times

Last updated: Jan 06 '16