aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohan Jansen <jnsn.johan@gmail.com>2015-01-06 13:57:27 +0100
committerJohan Jansen <jnsn.johan@gmail.com>2015-01-15 14:37:51 +0100
commit6edb54ff7755fbb30c695984cf53b246ff497141 (patch)
treeb0da62d63b6e920eec76a0c3a85fc4e213fabcc5 /src
parent6978ed6a61212859d1c58c769ce75f343bc2e4ca (diff)
downloadpx4-firmware-6edb54ff7755fbb30c695984cf53b246ff497141.tar.gz
px4-firmware-6edb54ff7755fbb30c695984cf53b246ff497141.tar.bz2
px4-firmware-6edb54ff7755fbb30c695984cf53b246ff497141.zip
sdlog2: Added land detector log message (removed from local pos)
Diffstat (limited to 'src')
-rw-r--r--src/modules/sdlog2/sdlog2.c12
-rw-r--r--src/modules/sdlog2/sdlog2_messages.h7
2 files changed, 18 insertions, 1 deletions
diff --git a/src/modules/sdlog2/sdlog2.c b/src/modules/sdlog2/sdlog2.c
index d35b70239..b470eefac 100644
--- a/src/modules/sdlog2/sdlog2.c
+++ b/src/modules/sdlog2/sdlog2.c
@@ -72,6 +72,7 @@
#include <uORB/topics/actuator_outputs.h>
#include <uORB/topics/actuator_controls.h>
#include <uORB/topics/vehicle_command.h>
+#include <uORB/topics/vehicle_land_detected.h>
#include <uORB/topics/vehicle_local_position.h>
#include <uORB/topics/vehicle_local_position_setpoint.h>
#include <uORB/topics/vehicle_global_position.h>
@@ -981,6 +982,7 @@ int sdlog2_thread_main(int argc, char *argv[])
struct vehicle_local_position_s local_pos;
struct vehicle_local_position_setpoint_s local_pos_sp;
struct vehicle_global_position_s global_pos;
+ struct vehicle_land_detected_s land_detector;
struct position_setpoint_triplet_s triplet;
struct vehicle_vicon_position_s vicon_pos;
struct vision_position_estimate vision_pos;
@@ -1016,6 +1018,7 @@ int sdlog2_thread_main(int argc, char *argv[])
struct log_SENS_s log_SENS;
struct log_LPOS_s log_LPOS;
struct log_LPSP_s log_LPSP;
+ struct log_LAND_s log_LAND;
struct log_GPS_s log_GPS;
struct log_ATTC_s log_ATTC;
struct log_STAT_s log_STAT;
@@ -1082,6 +1085,7 @@ int sdlog2_thread_main(int argc, char *argv[])
int servorail_status_sub;
int wind_sub;
int encoders_sub;
+ int land_detector_sub;
} subs;
subs.cmd_sub = orb_subscribe(ORB_ID(vehicle_command));
@@ -1112,6 +1116,8 @@ int sdlog2_thread_main(int argc, char *argv[])
subs.system_power_sub = orb_subscribe(ORB_ID(system_power));
subs.servorail_status_sub = orb_subscribe(ORB_ID(servorail_status));
subs.wind_sub = orb_subscribe(ORB_ID(wind_estimate));
+ subs.land_detector_sub = orb_subscribe(ORB_ID(vehicle_land_detected));
+
/* we need to rate-limit wind, as we do not need the full update rate */
orb_set_interval(subs.wind_sub, 90);
subs.encoders_sub = orb_subscribe(ORB_ID(encoders));
@@ -1514,13 +1520,17 @@ int sdlog2_thread_main(int argc, char *argv[])
(buf.local_pos.v_z_valid ? 8 : 0) |
(buf.local_pos.xy_global ? 16 : 0) |
(buf.local_pos.z_global ? 32 : 0);
- log_msg.body.log_LPOS.landed = buf.local_pos.landed;
log_msg.body.log_LPOS.ground_dist_flags = (buf.local_pos.dist_bottom_valid ? 1 : 0);
log_msg.body.log_LPOS.eph = buf.local_pos.eph;
log_msg.body.log_LPOS.epv = buf.local_pos.epv;
LOGBUFFER_WRITE_AND_COUNT(LPOS);
}
+ /* --- LAND DETECTED --- */
+ if (copy_if_updated(ORB_ID(vehicle_land_detected), subs.land_detector_sub, &buf.land_detector)) {
+ log_msg.body.log_LAND.landed = buf.land_detector.landed;
+ }
+
/* --- LOCAL POSITION SETPOINT --- */
if (copy_if_updated(ORB_ID(vehicle_local_position_setpoint), subs.local_pos_sp_sub, &buf.local_pos_sp)) {
log_msg.msg_type = LOG_LPSP_MSG;
diff --git a/src/modules/sdlog2/sdlog2_messages.h b/src/modules/sdlog2/sdlog2_messages.h
index 5941bfac0..246f5129f 100644
--- a/src/modules/sdlog2/sdlog2_messages.h
+++ b/src/modules/sdlog2/sdlog2_messages.h
@@ -427,6 +427,12 @@ struct log_ENCD_s {
/* --- AIR SPEED SENSORS - DIFF. PRESSURE --- */
#define LOG_AIR1_MSG 40
+/* --- LAND - LAND DETECTOR --- */
+#define LOG_LAND_MSG 41
+struct log_LAND_s {
+ uint8_t landed;
+};
+
/********** SYSTEM MESSAGES, ID > 0x80 **********/
/* --- TIME - TIME STAMP --- */
@@ -495,6 +501,7 @@ static const struct log_format_s log_formats[] = {
LOG_FORMAT(TECS, "fffffffffffffB", "ASP,AF,FSP,F,FF,AsSP,AsF,AsDSP,AsD,TERSP,TER,EDRSP,EDR,M"),
LOG_FORMAT(WIND, "ffff", "X,Y,CovX,CovY"),
LOG_FORMAT(ENCD, "qfqf", "cnt0,vel0,cnt1,vel1"),
+ LOG_FORMAT(LAND, "B", "landed"),
/* system-level messages, ID >= 0x80 */
/* FMT: don't write format of format message, it's useless */