This commit is contained in:
vivek-shankar 2017-01-31 03:57:03 -05:00
parent f51e657103
commit 59251e7af2
3 changed files with 18 additions and 13 deletions

Binary file not shown.

View File

@ -12,10 +12,10 @@
/*Temp for data collection*/ /*Temp for data collection*/
//static int neigh=-1; //static int neigh=-1;
//static struct timeval t1, t2; static struct timeval t1, t2;
static int timer_steps=0; static int timer_steps=0;
//static clock_t end; //static clock_t end;
//void collect_data(); void collect_data();
/*Temp end */ /*Temp end */
static int fd,wd =0; static int fd,wd =0;
static int old_update =0; static int old_update =0;
@ -294,9 +294,11 @@ buzzvm_pushs(VM, buzzvm_string_register(VM, "update_no", 1));
} }
else{ else{
gettimeofday(&t1, NULL);
if(neigh==0 && (!is_msg_present())){ if(neigh==0 && (!is_msg_present())){
fprintf(stdout,"Sending code... \n"); fprintf(stdout,"Sending code... \n");
code_message_outqueue_append(); code_message_outqueue_append();
} }
timer_steps++; timer_steps++;
buzzvm_pushs(VM, buzzvm_string_register(VM, "barrier_val",1)); buzzvm_pushs(VM, buzzvm_string_register(VM, "barrier_val",1));
@ -306,7 +308,8 @@ buzzvm_pushs(VM, buzzvm_string_register(VM, "update_no", 1));
fprintf(stdout,"Barrier ..................... %i \n",tObj->i.value); fprintf(stdout,"Barrier ..................... %i \n",tObj->i.value);
if(tObj->i.value==no_of_robot) { if(tObj->i.value==no_of_robot) {
*(int*)(updater->mode) = CODE_RUNNING; *(int*)(updater->mode) = CODE_RUNNING;
//collect_data(); gettimeofday(&t2, NULL);
collect_data();
timer_steps=0; timer_steps=0;
//neigh=-1; //neigh=-1;
//buzz_utility::buzz_update_set((updater)->bcode, (char*)dbgfname, *(size_t*)(updater->bcode_size)); //buzz_utility::buzz_update_set((updater)->bcode, (char*)dbgfname, *(size_t*)(updater->bcode_size));
@ -443,12 +446,13 @@ bzz_file=in_bzz_file;
} }
void collect_data(){ void collect_data(){
//fprintf(stdout,"start and end time in data collection Info : %f,%f",(double)begin,(double)end); //fprintf(stdout,"start and end time in data collection Info : %f,%f",(double)begin,(double)end);
//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;
//fprintf(stdout,"Data logger Info : %i,%i,%f,%i,%i,%i\n",(int)updater->robotid,neigh,time_spent,(int)updater->bcode_size,(int)no_of_robot,(int)updater->update_no); //int bytecodesize=(int);
FILE *Fileptr; 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);
Fileptr=fopen("/home/ubuntu/ROS_WS/update_logger.csv", "a"); //FILE *Fileptr;
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); //Fileptr=fopen("/home/ubuntu/ROS_WS/update_logger.csv", "a");
fclose(Fileptr); //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);
//fclose(Fileptr);
} }

View File

@ -1,7 +1,7 @@
# We need this for 2D vectors # We need this for 2D vectors
# Make sure you pass the correct include path to "bzzc -I <path1:path2> ..." # Make sure you pass the correct include path to "bzzc -I <path1:path2> ..."
include "/home/ubuntu/buzz/src/include/vec2.bzz" include "/home/vivek/catkin_ws/src/rosbuzz/src/vec2.bzz"
#################################################################################################### ####################################################################################################
# Updater related # Updater related
# This should be here for the updater to work, changing position of code will crash the updater # This should be here for the updater to work, changing position of code will crash the updater
@ -98,10 +98,11 @@ neighbors.listen("cmd",
statef=land statef=land
} }
} }
if( flight.status == 2 and position.altitude >= TARGET_ALTITUDE-TARGET_ALTITUDE/20.0)
statef=hexagon
) )
if( flight.status == 2 and position.altitude >= TARGET_ALTITUDE-TARGET_ALTITUDE/20.0)
statef=hexagon
} }
function takeoff() { function takeoff() {