Home | Tutorials | Wiki | Issues
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In general I would not use setJointPosition or setAngle if you have the physics on, but use some sort of a controller. If you want a simple one, just use the gazebo PID controller and therefore I use dynamic reconfigure to set the PID values, which is quite convenient for me.

Here's an example of a controller of the drcsim car.

And that's an example how you would get the dynamic reconfigure in. (Or you can check out gazebo_ros_multicamera_utils.cpp

dyn_srv_ = new dynamic_reconfigure::Server<some_plugins::MyConfig>(*this->rosnode_);
dynamic_reconfigure::Server<some_plugins::MyConfig>::CallbackType f = boost::bind(&MyClass::DynamicReconfigureCallback, this, _1, _2);
dyn_srv_->setCallback(f);


void MyClass::DynamicReconfigureCallback(some_plugins::MyConfig &config, uint32_t level)
{
    // Wheel gains
    oneWheelPID.SetPGain(config.p_wheel);
    oneWheelPID.SetIGain(config.i_wheel);
    oneWheelPID.SetDGain(config.d_wheel);
    // Steering gains
    oneWheelSteeringPID.SetPGain(config.p_steering);
    oneWheelSteeringPID.SetIGain(config.i_steering);
    oneWheelSteeringPID.SetDGain(config.d_steering);
}