From 4dbcecf2da885c72474d2d06073f7ea6c85a2999 Mon Sep 17 00:00:00 2001 From: vivek-shankar Date: Sun, 2 Apr 2017 21:43:36 -0400 Subject: [PATCH] Robots variable fix --- include/roscontroller.h | 1 + launch/rosbuzz.launch | 3 +-- launch/rosbuzzm100.launch | 1 + src/roscontroller.cpp | 5 +++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/roscontroller.h b/include/roscontroller.h index 456d5eb..370fcf0 100644 --- a/include/roscontroller.h +++ b/include/roscontroller.h @@ -59,6 +59,7 @@ private: int armstate; int barrier; int message_number=0; + int no_of_robots=0; std::string bzzfile_name, fcclient_name, armclient, modeclient, rcservice_name,bcfname,dbgfname,out_payload,in_payload,stand_by,xbeesrv_name; bool rcclient; bool multi_msg; diff --git a/launch/rosbuzz.launch b/launch/rosbuzz.launch index eb901e7..16e86c2 100644 --- a/launch/rosbuzz.launch +++ b/launch/rosbuzz.launch @@ -8,8 +8,7 @@ - - + diff --git a/launch/rosbuzzm100.launch b/launch/rosbuzzm100.launch index e30a10b..c44b99e 100644 --- a/launch/rosbuzzm100.launch +++ b/launch/rosbuzzm100.launch @@ -8,6 +8,7 @@ + diff --git a/src/roscontroller.cpp b/src/roscontroller.cpp index 5be8d5d..da7c8a7 100644 --- a/src/roscontroller.cpp +++ b/src/roscontroller.cpp @@ -73,9 +73,10 @@ namespace rosbzz_node{ multi_msg=true; } /*Set ROBOTS variable for barrier in .bzz from neighbours count*/ - buzz_utility::set_robot_var(raw_neighbours_pos_map.size()+1); + if(neighbours_pos_map.size() >0) no_of_robots =neighbours_pos_map.size()+1; + buzz_utility::set_robot_var(no_of_robots); /*Set no of robots for updates*/ - updates_set_robots(raw_neighbours_pos_map.size()+1); + updates_set_robots(no_of_robots); /*run once*/ ros::spinOnce(); /*loop rate of ros*/