How correctly move joints by SetPosition() ?
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.
Asked by Ivanchik on 2015-11-24 08:11:18 UTC
Answers
Hi,
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)
this->jointController->SetPositionPID((*it)->GetScopedName(),PID);
// Set target
this->jointController->SetPositionTarget((*it)->GetScopedName(), target);
// Update the controller
this->jointController->Update();
Here is the doc: https://osrf-distributions.s3.amazonaws.com/gazebo/api/dev/classgazebo_1_1physics_1_1JointController.html
Asked by debz on 2016-01-06 12:57:05 UTC
Comments
I don't see the Setposition function anywhere in the code above...
Asked by sofia.gr on 2017-07-14 10:17:44 UTC
Comments