control toolbox pid
Here is the pid controller code i used in hardware inteface of my diff drive controller:
RRBotHWInterface::RRBotHWInterface(ros::NodeHandle &nh, urdf::Model *urdf_model)
: ros_control_boilerplate::GenericHWInterface(nh, urdf_model)
{
ROS_INFO_NAMED("rrbot_hw_interface", "RRBotHWInterface Ready.");
pid1.initPid(0.1, 0.01, 0.01, 255.0, -255.0);
pid2.initPid(0.1, 0.01, 0.01, 255.0, -255.0);
Setup();
}
double vel_err1 = joint_velocity_[0] - joint_velocity_command_[0];
double vel_err2 = joint_velocity_[1] - joint_velocity_command_[1];
double joint1_vel = pid1.updatePid(vel_err1, elapsed_time);
double joint2_vel = pid2.updatePid(vel_err2, elapsed_time);
But whenever i run this code the jonit1_vel and joint2_vel are only coming at max 2. The max velocity thaat i provide is 10.