mavlink: handle cellular_status messages for logging

This commit is contained in:
JaeyoungLim 2019-11-13 15:19:02 +01:00 committed by Daniel Agar
parent 675af4f5f9
commit 6bd4273b9c
6 changed files with 40 additions and 0 deletions

View File

@ -41,6 +41,7 @@ set(msg_files
battery_status.msg
camera_capture.msg
camera_trigger.msg
cellular_status.msg
collision_report.msg
collision_constraints.msg
commander_state.msg

9
msg/cellular_status.msg Normal file
View File

@ -0,0 +1,9 @@
uint64 timestamp # time since system start (microseconds)
uint16 status # Status bitmap 1: Roaming is active
uint8 type # Cellular network radio type 0: none 1: gsm 2: cdma 3: wcdma 4: lte
uint8 quality # Cellular network RSSI/RSRP in dBm, absolute value
uint16 mcc # Mobile country code. If unknown, set to: UINT16_MAX
uint16 mnc # Mobile network code. If unknown, set to: UINT16_MAX
uint16 lac # Location area code. If unknown, set to: 0
uint32 cid # Cell ID. If unknown, set to: UINT32_MAX

View File

@ -262,6 +262,8 @@ rtps:
id: 115
- msg: onboard_computer_status
id: 116
- msg: cellular_status
id: 117
########## multi topics: begin ##########
- msg: actuator_controls_0
id: 150

View File

@ -637,6 +637,7 @@ void Logger::add_sensor_comparison_topics()
void Logger::add_vision_and_avoidance_topics()
{
add_topic("cellular_status", 200);
add_topic("collision_constraints");
add_topic("obstacle_distance_fused");
add_topic("onboard_computer_status", 200);

View File

@ -190,6 +190,10 @@ MavlinkReceiver::handle_message(mavlink_message_t *msg)
handle_message_landing_target(msg);
break;
case MAVLINK_MSG_ID_CELLULAR_STATUS:
handle_message_cellular_status(msg);
break;
case MAVLINK_MSG_ID_ADSB_VEHICLE:
handle_message_adsb_vehicle(msg);
break;
@ -2194,6 +2198,26 @@ MavlinkReceiver::handle_message_landing_target(mavlink_message_t *msg)
}
}
void
MavlinkReceiver::handle_message_cellular_status(mavlink_message_t *msg)
{
mavlink_cellular_status_t status;
mavlink_msg_cellular_status_decode(msg, &status);
cellular_status_s cellular_status{};
cellular_status.timestamp = hrt_absolute_time();
cellular_status.status = status.status;
cellular_status.type = status.type;
cellular_status.quality = status.quality;
cellular_status.mcc = status.mcc;
cellular_status.mnc = status.mnc;
cellular_status.lac = status.lac;
cellular_status.cid = status.cid;
_cellular_status_pub.publish(cellular_status);
}
void
MavlinkReceiver::handle_message_adsb_vehicle(mavlink_message_t *msg)
{

View File

@ -57,6 +57,7 @@
#include <uORB/topics/airspeed.h>
#include <uORB/topics/airspeed.h>
#include <uORB/topics/battery_status.h>
#include <uORB/topics/cellular_status.h>
#include <uORB/topics/collision_report.h>
#include <uORB/topics/debug_array.h>
#include <uORB/topics/debug_key_value.h>
@ -131,6 +132,7 @@ private:
void handle_message_adsb_vehicle(mavlink_message_t *msg);
void handle_message_att_pos_mocap(mavlink_message_t *msg);
void handle_message_battery_status(mavlink_message_t *msg);
void handle_message_cellular_status(mavlink_message_t *msg);
void handle_message_collision(mavlink_message_t *msg);
void handle_message_command_ack(mavlink_message_t *msg);
void handle_message_command_int(mavlink_message_t *msg);
@ -222,6 +224,7 @@ private:
uORB::Publication<actuator_controls_s> _actuator_controls_pubs[4] {ORB_ID(actuator_controls_0), ORB_ID(actuator_controls_1), ORB_ID(actuator_controls_2), ORB_ID(actuator_controls_3)};
uORB::Publication<airspeed_s> _airspeed_pub{ORB_ID(airspeed)};
uORB::Publication<battery_status_s> _battery_pub{ORB_ID(battery_status)};
uORB::Publication<cellular_status_s> _cellular_status_pub{ORB_ID(cellular_status)};
uORB::Publication<collision_report_s> _collision_report_pub{ORB_ID(collision_report)};
uORB::Publication<debug_array_s> _debug_array_pub{ORB_ID(debug_array)};
uORB::Publication<debug_key_value_s> _debug_key_value_pub{ORB_ID(debug_key_value)};