swarm test

This commit is contained in:
David St-Onge 2017-04-10 14:49:01 -04:00
parent 6fb86e7dd0
commit 1cc44d3d56
3 changed files with 13 additions and 9 deletions

View File

@ -454,7 +454,7 @@ void collect_data(){
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;
//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;
//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);

View File

@ -473,17 +473,18 @@ namespace buzz_utility{
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
/* look into this currently we don't have swarm feature tested */
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
usleep(10000);
/*Print swarm*/
//buzzswarm_members_print(stdout, VM->swarmmembers, VM->robot);
buzzswarm_members_print(stdout, VM->swarmmembers, VM->robot);
/* Check swarm state */
/* int status = 1;
int status = 1;
buzzdict_foreach(VM->swarmmembers, check_swarm_members, &status);
if(status == 1 &&
buzzdict_size(VM->swarmmembers) < 9)
status = 2;
buzzvm_pushs(VM, buzzvm_string_register(VM, "swarm_status", 1));
buzzvm_pushi(VM, status);
buzzvm_gstore(VM);*/
buzzvm_gstore(VM);
}
/****************************************/
@ -533,16 +534,16 @@ namespace buzz_utility{
return a == BUZZVM_STATE_READY;
}
uint16_t get_robotid() {
/* Get hostname */
/* uint16_t get_robotid() {
// Get hostname
char hstnm[30];
gethostname(hstnm, 30);
/* Make numeric id from hostname */
/* NOTE: here we assume that the hostname is in the format Knn */
// Make numeric id from hostname
// NOTE: here we assume that the hostname is in the format Knn
int id = strtol(hstnm + 4, NULL, 10);
//fprintf(stdout, "Robot id from get rid buzz util: %i\n",id);
return (uint16_t)id;
}
}*/
buzzvm_t get_vm() {
return VM;

View File

@ -144,6 +144,9 @@ function land() {
# Executed once at init time.
function init() {
s = swarm.create(1)
s.select(1)
s.join()
statef=idle
CURSTATE = "IDLE"
}