|Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.|
Settings configuration of asr_flir_ptu_driverDescription: This tutorial describes how to configure the dynamic settings of asr_flir_ptu_driver
Tutorial Level: BEGINNER
This tutorial contains no executable code but code pieces that show how manipulation of the asr_flir_ptu_driver settings works. If you want to try them out in your own code have a FLIR PTU connected to your system and have asr_flir_ptu_driver running as described in the corresponding documentation.
This tutorial will cover how you can change different settings of the PTU using the parameter server and services. No further includes are needed.
Setting of all parameters works over the parameter server. A list of all parameters can be found under point 4.3 here. To pass a new parameter to the PTU first pass it to the parameter server, e.g.:
ros::NodeHandle nh(""); nh.setParam("/asr_flir_ptu_driver/pan_min_angle", -50.0);
Set all the parameters you want to pass to the PTU this way. Setting the parameters will not occur immediately, but only if you call the corrseponding service. There are two services for passing the parameters to the PTU: The "update_settings"-service and the "update_speed_control"-service. Both are handled the same way and they only differ in the parameters they are "sending" to the PTU. The difference can found in section 4.5; in the following we will be using the "update_settings"-service. By invoking the service the parameters will be forwarded to the PTU:
updater = nh.serviceClient<std_srvs::Empty>("/asr_flir_ptu_driver/update_settings"); std_srvs::Empty empty; updater.call(empty);
The PTU will now update its settings. It is possible that some values get rejected; e.g. if the pan/tilt limits extend the physical possibilities of the PTU. As soon as the PTU has finished the setting process, the current values of the PTU will be published to the parameter server under the same parameter names. Read the values from there if everything went right to see if something got rejected etc.:
double current_pan_min_angle; nh.getParam("/asr_flir_ptu_driver/pan_min_angle", current_pan_min_angle);