stream rate wait

This commit is contained in:
isvogor 2017-03-31 15:13:25 -04:00
parent a9335d973a
commit dfa7519bd5
2 changed files with 6 additions and 5 deletions

View File

@ -18,7 +18,7 @@
</include>
<!-- set streaming rate -->
<node pkg="rosservice" type="rosservice" name="freq" args="call /mavros/set_stream_rate 0 10 1" output="screen" />
<!-- node pkg="rosservice" type="rosservice" name="freq" args="call /mavros/set_stream_rate 0 10 1" output="screen" / -->
<!-- run xbee -->
<node pkg="xbee_ros_node" type="xbee_mav" name="xbee_mav" args="slave swarm" output="screen" />

View File

@ -686,11 +686,12 @@ namespace rosbzz_node{
message.request.stream_id = id;
message.request.message_rate = rate;
message.request.on_off = on_off;
if(stream_client.call(message)){
ROS_INFO("Set Mode Service call successful!");
} else {
ROS_INFO("Set Mode Service call failed!");
while(!stream_client.call(message)){
ROS_INFO("Set stream rate call failed!, trying again...");
std::this_thread::sleep_for( std::chrono::milliseconds ( 2000 ) );
}
ROS_INFO("Set stream rate call successful");
}