swarm test
This commit is contained in:
parent
6fb86e7dd0
commit
1cc44d3d56
|
@ -454,7 +454,7 @@ void collect_data(){
|
||||||
double time_spent = (t2.tv_sec - t1.tv_sec) * 1000.0; //(double)(end - begin) / CLOCKS_PER_SEC;
|
double time_spent = (t2.tv_sec - t1.tv_sec) * 1000.0; //(double)(end - begin) / CLOCKS_PER_SEC;
|
||||||
time_spent += (t2.tv_usec - t1.tv_usec) / 1000.0;
|
time_spent += (t2.tv_usec - t1.tv_usec) / 1000.0;
|
||||||
//int bytecodesize=(int);
|
//int bytecodesize=(int);
|
||||||
fprintf(stdout,"Data logger Info : %i , %i , %f , %ld , %i , %d \n",(int)buzz_utility::get_robotid(),neigh,time_spent,*(size_t*)updater->bcode_size,(int)no_of_robot,*(uint8_t*)updater->update_no);
|
fprintf(stdout,"Data logger Info : %i , %i , %f , %ld , %i , %d \n",(int)no_of_robot,neigh,time_spent,*(size_t*)updater->bcode_size,(int)no_of_robot,*(uint8_t*)updater->update_no);
|
||||||
//FILE *Fileptr;
|
//FILE *Fileptr;
|
||||||
//Fileptr=fopen("/home/ubuntu/ROS_WS/update_logger.csv", "a");
|
//Fileptr=fopen("/home/ubuntu/ROS_WS/update_logger.csv", "a");
|
||||||
//fprintf(Fileptr,"%i,%i,%i,%i,%i,%u\n",(int)buzz_utility::get_robotid(),neigh,timer_steps,(int)*(size_t*)updater->bcode_size,(int)no_of_robot, *(uint8_t*)updater->update_no);
|
//fprintf(Fileptr,"%i,%i,%i,%i,%i,%u\n",(int)buzz_utility::get_robotid(),neigh,timer_steps,(int)*(size_t*)updater->bcode_size,(int)no_of_robot, *(uint8_t*)updater->update_no);
|
||||||
|
|
|
@ -473,17 +473,18 @@ namespace buzz_utility{
|
||||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||||
/* look into this currently we don't have swarm feature tested */
|
/* look into this currently we don't have swarm feature tested */
|
||||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||||
|
usleep(10000);
|
||||||
/*Print swarm*/
|
/*Print swarm*/
|
||||||
//buzzswarm_members_print(stdout, VM->swarmmembers, VM->robot);
|
buzzswarm_members_print(stdout, VM->swarmmembers, VM->robot);
|
||||||
/* Check swarm state */
|
/* Check swarm state */
|
||||||
/* int status = 1;
|
int status = 1;
|
||||||
buzzdict_foreach(VM->swarmmembers, check_swarm_members, &status);
|
buzzdict_foreach(VM->swarmmembers, check_swarm_members, &status);
|
||||||
if(status == 1 &&
|
if(status == 1 &&
|
||||||
buzzdict_size(VM->swarmmembers) < 9)
|
buzzdict_size(VM->swarmmembers) < 9)
|
||||||
status = 2;
|
status = 2;
|
||||||
buzzvm_pushs(VM, buzzvm_string_register(VM, "swarm_status", 1));
|
buzzvm_pushs(VM, buzzvm_string_register(VM, "swarm_status", 1));
|
||||||
buzzvm_pushi(VM, status);
|
buzzvm_pushi(VM, status);
|
||||||
buzzvm_gstore(VM);*/
|
buzzvm_gstore(VM);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
@ -533,16 +534,16 @@ namespace buzz_utility{
|
||||||
return a == BUZZVM_STATE_READY;
|
return a == BUZZVM_STATE_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t get_robotid() {
|
/* uint16_t get_robotid() {
|
||||||
/* Get hostname */
|
// Get hostname
|
||||||
char hstnm[30];
|
char hstnm[30];
|
||||||
gethostname(hstnm, 30);
|
gethostname(hstnm, 30);
|
||||||
/* Make numeric id from hostname */
|
// Make numeric id from hostname
|
||||||
/* NOTE: here we assume that the hostname is in the format Knn */
|
// NOTE: here we assume that the hostname is in the format Knn
|
||||||
int id = strtol(hstnm + 4, NULL, 10);
|
int id = strtol(hstnm + 4, NULL, 10);
|
||||||
//fprintf(stdout, "Robot id from get rid buzz util: %i\n",id);
|
//fprintf(stdout, "Robot id from get rid buzz util: %i\n",id);
|
||||||
return (uint16_t)id;
|
return (uint16_t)id;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
buzzvm_t get_vm() {
|
buzzvm_t get_vm() {
|
||||||
return VM;
|
return VM;
|
||||||
|
|
|
@ -144,6 +144,9 @@ function land() {
|
||||||
|
|
||||||
# Executed once at init time.
|
# Executed once at init time.
|
||||||
function init() {
|
function init() {
|
||||||
|
s = swarm.create(1)
|
||||||
|
s.select(1)
|
||||||
|
s.join()
|
||||||
statef=idle
|
statef=idle
|
||||||
CURSTATE = "IDLE"
|
CURSTATE = "IDLE"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue