|
@@ -25,12 +25,12 @@ int CWheel_Kd = 34;
|
|
|
void dynamic_callback(dynamic_tutorials::TutorialsConfig &config)
|
|
|
{
|
|
|
ROS_INFO("Reconfigure Request: %d %d %d %d %d %d",
|
|
|
- config.AWheel_Kp,
|
|
|
- config.AWheel_Kd,
|
|
|
- config.BWheel_Kp,
|
|
|
- config.BWheel_Kd,
|
|
|
- config.CWheel_Kp,
|
|
|
- config.CWheel_Kd);
|
|
|
+ config.AWheel_Kp,
|
|
|
+ config.AWheel_Kd,
|
|
|
+ config.BWheel_Kp,
|
|
|
+ config.BWheel_Kd,
|
|
|
+ config.CWheel_Kp,
|
|
|
+ config.CWheel_Kd);
|
|
|
|
|
|
AWheel_Kp = config.AWheel_Kp;
|
|
|
AWheel_Kd = config.AWheel_Kd;
|
|
@@ -39,25 +39,25 @@ void dynamic_callback(dynamic_tutorials::TutorialsConfig &config)
|
|
|
CWheel_Kp = config.CWheel_Kp;
|
|
|
CWheel_Kd = config.CWheel_Kd;
|
|
|
|
|
|
- ros::NodeHandle nh;
|
|
|
- ros::ServiceClient client = nh.serviceClient<ros_arduino_msgs::DynamicPID>("/mobilebase_arduino/dynamic_pid");
|
|
|
- ros_arduino_msgs::DynamicPID srv;
|
|
|
- srv.request.value1 = AWheel_Kp;
|
|
|
- srv.request.value2 = AWheel_Kd;
|
|
|
- srv.request.value3 = BWheel_Kp;
|
|
|
- srv.request.value4 = BWheel_Kd;
|
|
|
- srv.request.value5 = CWheel_Kp;
|
|
|
- srv.request.value6 = CWheel_Kd;
|
|
|
- //发布pid参数
|
|
|
- if (client.call(srv))
|
|
|
+ ros::NodeHandle nh;
|
|
|
+ ros::ServiceClient client = nh.serviceClient<ros_arduino_msgs::DynamicPID>("/mobilebase_arduino/dynamic_pid");
|
|
|
+ ros_arduino_msgs::DynamicPID srv;
|
|
|
+ srv.request.A_kp = AWheel_Kp;
|
|
|
+ srv.request.A_kd = AWheel_Kd;
|
|
|
+ srv.request.B_kp = BWheel_Kp;
|
|
|
+ srv.request.B_kd = BWheel_Kd;
|
|
|
+ srv.request.C_kp = CWheel_Kp;
|
|
|
+ srv.request.C_kd = CWheel_Kd;
|
|
|
+
|
|
|
+ //发布pid参数
|
|
|
+ if (client.call(srv))
|
|
|
{
|
|
|
- ROS_INFO("Call service DynamicPID sucessfully.");
|
|
|
+ ROS_INFO("Call service DynamicPID sucessfully.");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ROS_ERROR("Failed to call service DynamicPID");
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -67,8 +67,9 @@ int main(int argc, char **argv)
|
|
|
dynamic_reconfigure::Server<dynamic_tutorials::TutorialsConfig> server;
|
|
|
dynamic_reconfigure::Server<dynamic_tutorials::TutorialsConfig>::CallbackType callback;
|
|
|
|
|
|
- callback = boost::bind(&dynamic_callback, _1);
|
|
|
+ callback = boost::bind(&dynamic_callback, _1);
|
|
|
server.setCallback(callback);
|
|
|
ros::spin();
|
|
|
+
|
|
|
return 0;
|
|
|
}
|