aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortumbili <bapstr@ethz.ch>2015-01-18 17:46:25 +0100
committertumbili <bapstr@ethz.ch>2015-01-18 18:00:14 +0100
commit3a05b571690ce675f56184cd5c5168f7699f9a03 (patch)
tree1d659cd5183d800a25e1ff635b6c620769cfd9e1
parentbeab89367f5cc2765c747fb463a27ce001206dd9 (diff)
downloadpx4-firmware-3a05b571690ce675f56184cd5c5168f7699f9a03.tar.gz
px4-firmware-3a05b571690ce675f56184cd5c5168f7699f9a03.tar.bz2
px4-firmware-3a05b571690ce675f56184cd5c5168f7699f9a03.zip
log total airspeed for vtol
-rw-r--r--src/modules/sdlog2/sdlog2.c12
-rw-r--r--src/modules/sdlog2/sdlog2_messages.h6
2 files changed, 18 insertions, 0 deletions
diff --git a/src/modules/sdlog2/sdlog2.c b/src/modules/sdlog2/sdlog2.c
index 7b7949239..0cc193b6c 100644
--- a/src/modules/sdlog2/sdlog2.c
+++ b/src/modules/sdlog2/sdlog2.c
@@ -94,6 +94,7 @@
#include <uORB/topics/servorail_status.h>
#include <uORB/topics/wind_estimate.h>
#include <uORB/topics/encoders.h>
+#include <uORB/topics/vtol_vehicle_status.h>
#include <systemlib/systemlib.h>
#include <systemlib/param/param.h>
@@ -1000,6 +1001,7 @@ int sdlog2_thread_main(int argc, char *argv[])
struct satellite_info_s sat_info;
struct wind_estimate_s wind_estimate;
struct encoders_s encoders;
+ struct vtol_vehicle_status_s vtol_status;
} buf;
memset(&buf, 0, sizeof(buf));
@@ -1019,6 +1021,7 @@ int sdlog2_thread_main(int argc, char *argv[])
struct log_GPS_s log_GPS;
struct log_ATTC_s log_ATTC;
struct log_STAT_s log_STAT;
+ struct log_VTOL_s log_VTOL;
struct log_RC_s log_RC;
struct log_OUT0_s log_OUT0;
struct log_AIRS_s log_AIRS;
@@ -1053,6 +1056,7 @@ int sdlog2_thread_main(int argc, char *argv[])
struct {
int cmd_sub;
int status_sub;
+ int vtol_status_sub;
int sensor_sub;
int att_sub;
int att_sp_sub;
@@ -1086,6 +1090,7 @@ int sdlog2_thread_main(int argc, char *argv[])
subs.cmd_sub = orb_subscribe(ORB_ID(vehicle_command));
subs.status_sub = orb_subscribe(ORB_ID(vehicle_status));
+ subs.vtol_status_sub = orb_subscribe(ORB_ID(vtol_vehicle_status));
subs.gps_pos_sub = orb_subscribe(ORB_ID(vehicle_gps_position));
subs.sensor_sub = orb_subscribe(ORB_ID(sensor_combined));
subs.att_sub = orb_subscribe(ORB_ID(vehicle_attitude));
@@ -1219,6 +1224,13 @@ int sdlog2_thread_main(int argc, char *argv[])
LOGBUFFER_WRITE_AND_COUNT(STAT);
}
+ /* --- VTOL VEHICLE STATUS --- */
+ if(copy_if_updated(ORB_ID(vtol_vehicle_status), subs.vtol_status_sub, &buf.vtol_status)) {
+ log_msg.msg_type = LOG_VTOL_MSG;
+ log_msg.body.log_VTOL.airspeed_tot = buf.vtol_status.airspeed_tot;
+ LOGBUFFER_WRITE_AND_COUNT(VTOL);
+ }
+
/* --- GPS POSITION - UNIT #1 --- */
if (gps_pos_updated) {
diff --git a/src/modules/sdlog2/sdlog2_messages.h b/src/modules/sdlog2/sdlog2_messages.h
index 99f70a948..c9221d58a 100644
--- a/src/modules/sdlog2/sdlog2_messages.h
+++ b/src/modules/sdlog2/sdlog2_messages.h
@@ -426,6 +426,11 @@ struct log_ENCD_s {
/* --- AIR SPEED SENSORS - DIFF. PRESSURE --- */
#define LOG_AIR1_MSG 40
+/* --- VTOL - VTOL VEHICLE STATUS */
+#define LOG_VTOL_MSG 42
+struct log_VTOL_s {
+ float airspeed_tot;
+};
/********** SYSTEM MESSAGES, ID > 0x80 **********/
@@ -468,6 +473,7 @@ static const struct log_format_s log_formats[] = {
LOG_FORMAT_S(ATTC, ATTC, "ffff", "Roll,Pitch,Yaw,Thrust"),
LOG_FORMAT_S(ATC1, ATTC, "ffff", "Roll,Pitch,Yaw,Thrust"),
LOG_FORMAT(STAT, "BBBfBB", "MainState,ArmState,FailsafeState,BatRem,BatWarn,Landed"),
+ LOG_FORMAT(VTOL, "f", "Arsp"),
LOG_FORMAT(RC, "ffffffffBB", "Ch0,Ch1,Ch2,Ch3,Ch4,Ch5,Ch6,Ch7,Count,SignalLost"),
LOG_FORMAT(OUT0, "ffffffff", "Out0,Out1,Out2,Out3,Out4,Out5,Out6,Out7"),
LOG_FORMAT(AIRS, "fff", "IndSpeed,TrueSpeed,AirTemp"),