2016-10-10 21:22:17 -03:00
|
|
|
#pragma once
|
|
|
|
#include <stdio.h>
|
2019-04-10 15:14:19 -03:00
|
|
|
#include <rosbuzz/buzz_utility.h>
|
|
|
|
#include <rosbuzz/buzzuav_closures.h>
|
|
|
|
#include <rosbuzz/buzz_update.h>
|
2016-10-10 21:22:17 -03:00
|
|
|
#include <buzz/buzzdebug.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <iostream>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
using namespace std;
|
2017-12-08 19:53:32 -04:00
|
|
|
namespace buzz_utility
|
|
|
|
{
|
2016-10-10 21:22:17 -03:00
|
|
|
struct pos_struct
|
|
|
|
{
|
2017-12-08 19:53:32 -04:00
|
|
|
double x, y, z;
|
|
|
|
pos_struct(double x, double y, double z) : x(x), y(y), z(z){};
|
|
|
|
pos_struct()
|
|
|
|
{
|
|
|
|
}
|
2016-10-10 21:22:17 -03:00
|
|
|
};
|
2017-06-26 15:09:33 -03:00
|
|
|
typedef struct pos_struct Pos_struct;
|
|
|
|
struct rb_struct
|
|
|
|
{
|
2017-12-08 19:53:32 -04:00
|
|
|
double r, b, latitude, longitude, altitude;
|
|
|
|
rb_struct(double la, double lo, double al, double r, double b)
|
|
|
|
: latitude(la), longitude(lo), altitude(al), r(r), b(b){};
|
|
|
|
rb_struct()
|
|
|
|
{
|
|
|
|
}
|
2017-06-26 15:09:33 -03:00
|
|
|
};
|
|
|
|
typedef struct rb_struct RB_struct;
|
2016-10-10 21:22:17 -03:00
|
|
|
|
2017-08-09 20:23:42 -03:00
|
|
|
struct neiStatus
|
|
|
|
{
|
|
|
|
uint gps_strenght = 0;
|
|
|
|
uint batt_lvl = 0;
|
|
|
|
uint xbee = 0;
|
|
|
|
uint flight_status = 0;
|
2017-12-08 19:53:32 -04:00
|
|
|
};
|
|
|
|
typedef struct neiStatus neighbors_status;
|
2016-10-10 21:22:17 -03:00
|
|
|
|
2018-09-06 13:47:38 -03:00
|
|
|
struct neitime
|
|
|
|
{
|
|
|
|
uint64_t nei_hardware_time;
|
|
|
|
uint64_t nei_logical_time;
|
|
|
|
uint64_t node_hardware_time;
|
|
|
|
uint64_t node_logical_time;
|
|
|
|
double nei_rate;
|
|
|
|
double relative_rate;
|
|
|
|
int age;
|
|
|
|
neitime(uint64_t nht, uint64_t nlt, uint64_t mht, uint64_t mlt, double nr, double mr)
|
2018-12-04 11:34:07 -04:00
|
|
|
: nei_hardware_time(nht)
|
|
|
|
, nei_logical_time(nlt)
|
|
|
|
, node_hardware_time(mht)
|
|
|
|
, node_logical_time(mlt)
|
|
|
|
, nei_rate(nr)
|
|
|
|
, relative_rate(mr){};
|
2018-09-06 13:47:38 -03:00
|
|
|
neitime()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
typedef struct neitime neighbor_time;
|
|
|
|
|
2016-10-10 21:22:17 -03:00
|
|
|
uint16_t* u64_cvt_u16(uint64_t u64);
|
|
|
|
|
2017-12-08 19:53:32 -04:00
|
|
|
int buzz_listen(const char* type, int msg_size);
|
2017-05-07 00:40:50 -03:00
|
|
|
int make_table(buzzobj_t* t);
|
|
|
|
int buzzusers_reset();
|
2017-12-08 19:53:32 -04:00
|
|
|
int create_stig_tables();
|
2016-10-10 21:22:17 -03:00
|
|
|
|
2017-05-07 00:07:52 -03:00
|
|
|
void in_msg_append(uint64_t* payload);
|
2017-04-24 15:20:59 -03:00
|
|
|
|
2017-05-07 00:07:52 -03:00
|
|
|
uint64_t* obt_out_msg();
|
2016-10-10 21:22:17 -03:00
|
|
|
|
2017-05-07 00:07:52 -03:00
|
|
|
void update_sensors();
|
2016-10-10 21:22:17 -03:00
|
|
|
|
2017-12-08 19:53:32 -04:00
|
|
|
int buzz_script_set(const char* bo_filename, const char* bdbg_filename, int robot_id);
|
2017-01-08 14:17:13 -04:00
|
|
|
|
2017-12-08 19:53:32 -04:00
|
|
|
int buzz_update_set(uint8_t* UP_BO_BUF, const char* bdbg_filename, size_t bcode_size);
|
2017-01-08 14:17:13 -04:00
|
|
|
|
2017-12-08 19:53:32 -04:00
|
|
|
int buzz_update_init_test(uint8_t* UP_BO_BUF, const char* bdbg_filename, size_t bcode_size);
|
2017-01-08 14:17:13 -04:00
|
|
|
|
2016-10-10 21:22:17 -03:00
|
|
|
void buzz_script_step();
|
|
|
|
|
|
|
|
void buzz_script_destroy();
|
|
|
|
|
|
|
|
int buzz_script_done();
|
|
|
|
|
2017-01-08 14:17:13 -04:00
|
|
|
int update_step_test();
|
|
|
|
|
2017-04-20 17:07:36 -03:00
|
|
|
int get_robotid();
|
2017-01-08 14:17:13 -04:00
|
|
|
|
2018-09-07 01:05:19 -03:00
|
|
|
int get_swarmsize();
|
|
|
|
|
2017-01-27 09:10:27 -04:00
|
|
|
buzzvm_t get_vm();
|
2017-04-02 16:06:36 -03:00
|
|
|
|
|
|
|
void set_robot_var(int ROBOTS);
|
2017-08-30 22:02:37 -03:00
|
|
|
|
2019-04-10 15:14:19 -03:00
|
|
|
void set_ca_on_var(int CA_ON);
|
|
|
|
|
2017-08-30 22:02:37 -03:00
|
|
|
int get_inmsg_size();
|
2018-09-06 13:47:38 -03:00
|
|
|
|
|
|
|
std::vector<uint8_t*> get_inmsg_vector();
|
|
|
|
|
2018-09-07 01:05:19 -03:00
|
|
|
std::string get_bvmstate();
|
2016-10-10 21:22:17 -03:00
|
|
|
}
|