Combined Xbee status info into a structure for the buzz VM
This commit is contained in:
parent
69729d926b
commit
0f37bc22e0
|
@ -49,8 +49,6 @@ uint64_t* obt_out_msg();
|
|||
|
||||
void update_sensors();
|
||||
|
||||
void update_xbee_status();
|
||||
|
||||
int buzz_script_set(const char* bo_filename,
|
||||
const char* bdbg_filename, int robot_id);
|
||||
|
||||
|
|
|
@ -88,11 +88,10 @@ int buzzuav_gohome(buzzvm_t vm);
|
|||
* Updates battery information in Buzz
|
||||
*/
|
||||
int buzzuav_update_battery(buzzvm_t vm);
|
||||
int buzzuav_update_deque_full(buzzvm_t vm);
|
||||
int buzzuav_update_rssi(buzzvm_t vm);
|
||||
int buzzuav_update_raw_packet_loss(buzzvm_t vm);
|
||||
int buzzuav_update_filtered_packet_loss(buzzvm_t vm);
|
||||
int buzzuav_update_api_rssi(buzzvm_t vm);
|
||||
/*
|
||||
* Updates xbee_status information in Buzz
|
||||
*/
|
||||
int buzzuav_update_xbee_status(buzzvm_t vm);
|
||||
/*
|
||||
* Updates current position in Buzz
|
||||
*/
|
||||
|
|
|
@ -681,6 +681,7 @@ int create_stig_tables() {
|
|||
void update_sensors(){
|
||||
/* Update sensors*/
|
||||
buzzuav_closures::buzzuav_update_battery(VM);
|
||||
buzzuav_closures::buzzuav_update_xbee_status(VM);
|
||||
buzzuav_closures::buzzuav_update_prox(VM);
|
||||
buzzuav_closures::buzzuav_update_currentpos(VM);
|
||||
buzzuav_closures::update_neighbors(VM);
|
||||
|
@ -689,22 +690,11 @@ int create_stig_tables() {
|
|||
buzzuav_closures::buzzuav_update_flight_status(VM);
|
||||
}
|
||||
|
||||
void update_xbee_status(){
|
||||
/* Update sensors*/
|
||||
buzzuav_closures::buzzuav_update_deque_full(VM);
|
||||
buzzuav_closures::buzzuav_update_rssi(VM);
|
||||
buzzuav_closures::buzzuav_update_raw_packet_loss(VM);
|
||||
buzzuav_closures::buzzuav_update_filtered_packet_loss(VM);
|
||||
buzzuav_closures::buzzuav_update_api_rssi(VM);
|
||||
}
|
||||
|
||||
void buzz_script_step() {
|
||||
/*Process available messages*/
|
||||
in_message_process();
|
||||
/*Update sensors*/
|
||||
update_sensors();
|
||||
|
||||
update_xbee_status();
|
||||
/* Call Buzz step() function */
|
||||
if(buzzvm_function_call(VM, "step", 0) != BUZZVM_STATE_READY) {
|
||||
ROS_ERROR("%s: execution terminated abnormally: %s",
|
||||
|
|
|
@ -345,57 +345,49 @@ namespace buzzuav_closures{
|
|||
deque_full = state;
|
||||
}
|
||||
|
||||
int buzzuav_update_deque_full(buzzvm_t vm) {
|
||||
buzzvm_pushs(vm, buzzvm_string_register(vm, "deque_full", 1));
|
||||
buzzvm_pushi(vm, static_cast<uint8_t>(deque_full));
|
||||
buzzvm_gstore(vm);
|
||||
return vm->state;
|
||||
}
|
||||
|
||||
void set_rssi(float value)
|
||||
{
|
||||
rssi = value;
|
||||
}
|
||||
|
||||
int buzzuav_update_rssi(buzzvm_t vm) {
|
||||
buzzvm_pushs(vm, buzzvm_string_register(vm, "rssi", 1));
|
||||
buzzvm_pushf(vm, rssi);
|
||||
buzzvm_gstore(vm);
|
||||
return vm->state;
|
||||
}
|
||||
|
||||
void set_raw_packet_loss(float value)
|
||||
{
|
||||
raw_packet_loss = value;
|
||||
}
|
||||
|
||||
int buzzuav_update_raw_packet_loss(buzzvm_t vm) {
|
||||
buzzvm_pushs(vm, buzzvm_string_register(vm, "raw_packet_loss", 1));
|
||||
buzzvm_pushf(vm, raw_packet_loss);
|
||||
buzzvm_gstore(vm);
|
||||
return vm->state;
|
||||
}
|
||||
|
||||
void set_filtered_packet_loss(float value)
|
||||
{
|
||||
filtered_packet_loss = value;
|
||||
}
|
||||
|
||||
int buzzuav_update_filtered_packet_loss(buzzvm_t vm) {
|
||||
buzzvm_pushs(vm, buzzvm_string_register(vm, "filtered_packet_loss", 1));
|
||||
buzzvm_pushf(vm, filtered_packet_loss);
|
||||
buzzvm_gstore(vm);
|
||||
return vm->state;
|
||||
}
|
||||
|
||||
void set_api_rssi(float value)
|
||||
{
|
||||
api_rssi = value;
|
||||
}
|
||||
|
||||
int buzzuav_update_api_rssi(buzzvm_t vm) {
|
||||
int buzzuav_update_xbee_status(buzzvm_t vm) {
|
||||
buzzvm_pushs(vm, buzzvm_string_register(vm, "xbee_status", 1));
|
||||
buzzvm_pusht(vm);
|
||||
buzzvm_dup(vm);
|
||||
buzzvm_pushs(vm, buzzvm_string_register(vm, "deque_full", 1));
|
||||
buzzvm_pushi(vm, static_cast<uint8_t>(deque_full));
|
||||
buzzvm_tput(vm);
|
||||
buzzvm_dup(vm);
|
||||
buzzvm_pushs(vm, buzzvm_string_register(vm, "rssi", 1));
|
||||
buzzvm_pushf(vm, rssi);
|
||||
buzzvm_tput(vm);
|
||||
buzzvm_dup(vm);
|
||||
buzzvm_pushs(vm, buzzvm_string_register(vm, "raw_packet_loss", 1));
|
||||
buzzvm_pushf(vm, raw_packet_loss);
|
||||
buzzvm_tput(vm);
|
||||
buzzvm_dup(vm);
|
||||
buzzvm_pushs(vm, buzzvm_string_register(vm, "filtered_packet_loss", 1));
|
||||
buzzvm_pushf(vm, filtered_packet_loss);
|
||||
buzzvm_tput(vm);
|
||||
buzzvm_dup(vm);
|
||||
buzzvm_pushs(vm, buzzvm_string_register(vm, "api_rssi", 1));
|
||||
buzzvm_pushf(vm, api_rssi);
|
||||
buzzvm_tput(vm);
|
||||
buzzvm_gstore(vm);
|
||||
return vm->state;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue