[messages] dist_home and dist_wp in meters instead of squared

also add dist_home for ROTORCRAFT_NAV_STATUS
This commit is contained in:
Felix Ruess
2014-08-02 23:43:59 +02:00
parent 60f9291eac
commit c8e71d0aad
7 changed files with 18 additions and 13 deletions
+3 -2
View File
@@ -91,8 +91,8 @@
<field name="cur_stage" type="uint8"/>
<field name="pos_x" type="float" unit="m" format="%.1f"/>
<field name="pos_y" type="float" unit="m" format="%.1f"/>
<field name="dist2_wp" type="float" format="%.1f" unit="m^2"/>
<field name="dist2_home" type="float" format="%.1f" unit="m^2"/>
<field name="dist_wp" type="float" format="%.1f" unit="m"/>
<field name="dist_home" type="float" format="%.1f" unit="m"/>
<field name="circle_count" type="uint8"/>
<field name="oval_count" type="uint8"/>
</message>
@@ -1435,6 +1435,7 @@
<message name="ROTORCRAFT_NAV_STATUS" id="159">
<field name="block_time" type="uint16" unit="s"/>
<field name="stage_time" type="uint16" unit="s"/>
<field name="dist_home" type="float" format="%.1f" unit="m"/>
<field name="cur_block" type="uint8"/>
<field name="cur_stage" type="uint8"/>
<field name="horizontal_mode" type="uint8"/>
+3 -1
View File
@@ -204,7 +204,9 @@ bool_t nav_approaching_xy(float x, float y, float from_x, float from_y, float ap
#define SEND_NAVIGATION(_trans, _dev) { \
uint8_t _circle_count = NavCircleCount(); \
struct EnuCoor_f* pos = stateGetPositionEnu_f(); \
DOWNLINK_SEND_NAVIGATION(_trans, _dev, &nav_block, &nav_stage, &(pos->x), &(pos->y), &dist2_to_wp, &dist2_to_home, &_circle_count, &nav_oval_count); \
float dist_wp = sqrtf(dist2_to_wp); \
float dist_home = sqrtf(dist2_to_home); \
DOWNLINK_SEND_NAVIGATION(_trans, _dev, &nav_block, &nav_stage, &(pos->x), &(pos->y), &dist_wp, &dist_home, &_circle_count, &nav_oval_count); \
}
#define DownlinkSendWp(_trans, _dev, i) { \
@@ -105,8 +105,10 @@ static inline void nav_set_altitude( void );
#include "subsystems/datalink/telemetry.h"
static void send_nav_status(void) {
float dist_home = sqrtf(dist2_to_home);
DOWNLINK_SEND_ROTORCRAFT_NAV_STATUS(DefaultChannel, DefaultDevice,
&block_time, &stage_time,
&dist_home,
&nav_block, &nav_stage,
&horizontal_mode);
if (horizontal_mode == HORIZONTAL_MODE_ROUTE) {
+1 -1
View File
@@ -134,7 +134,7 @@ let _ =
let course = ref None in (* deg *)
let desired_course = ref 0. in (* deg *)
let get_navigation = fun _ values ->
let distance = sqrt (Pprz.float_assoc "dist2_wp" values) in
let distance = (try sqrt (Pprz.float_assoc "dist2_wp" values) with _ -> Pprz.float_assoc "dist_wp" values) in
draw da !desired_course !course distance in
ignore (Tm_Pprz.message_bind "NAVIGATION" get_navigation);
let get_gps = fun _ values ->
+1 -1
View File
@@ -187,7 +187,7 @@ let log_and_parse = fun ac_name (a:Aircraft.aircraft) msg values ->
| "NAVIGATION" ->
a.cur_block <- ivalue "cur_block";
a.cur_stage <- ivalue "cur_stage";
a.dist_to_wp <- sqrt (fvalue "dist2_wp")
a.dist_to_wp <- (try sqrt (fvalue "dist2_wp") with _ -> fvalue "dist_wp");
| "BAT" ->
a.throttle <- fvalue "throttle" /. 9600. *. 100.;
a.kill_mode <- ivalue "kill_auto_throttle" <> 0;
+4 -4
View File
@@ -122,8 +122,8 @@ static void on_Navigation(IvyClientPtr app, void *user_data, int argc, char *arg
<field name="cur_stage" type="uint8"/>
<field name="pos_x" type="float" unit="m" format="%.1f"/>
<field name="pos_y" type="float" unit="m" format="%.1f"/>
<field name="dist2_wp" type="float" format="%.1f" unit="m^2"/>
<field name="dist2_home" type="float" format="%.1f" unit="m^2"/>
<field name="dist_wp" type="float" format="%.1f" unit="m"/>
<field name="dist_home" type="float" format="%.1f" unit="m"/>
<field name="circle_count" type="uint8"/>
<field name="oval_count" type="uint8"/>
</message>
@@ -261,8 +261,8 @@ void send_ivy(void)
<field name="cur_stage" type="uint8"/>
<field name="pos_x" type="float" unit="m" format="%.1f"/>
<field name="pos_y" type="float" unit="m" format="%.1f"/>
<field name="dist2_wp" type="float" format="%.1f" unit="m^2"/>
<field name="dist2_home" type="float" format="%.1f" unit="m^2"/>
<field name="dist_wp" type="float" format="%.1f" unit="m"/>
<field name="dist_home" type="float" format="%.1f" unit="m"/>
<field name="circle_count" type="uint8"/>
<field name="oval_count" type="uint8"/>
</message>
+4 -4
View File
@@ -328,8 +328,8 @@ printf("gps_utm_zone %d\n", gps_utm_zone);
<field name="cur_stage" type="uint8"/>
<field name="pos_x" type="float" unit="m" format="%.1f"/>
<field name="pos_y" type="float" unit="m" format="%.1f"/>
<field name="dist2_wp" type="float" format="%.1f" unit="m^2"/>
<field name="dist2_home" type="float" format="%.1f" unit="m^2"/>
<field name="dist_wp" type="float" format="%.1f" unit="m"/>
<field name="dist_home" type="float" format="%.1f" unit="m"/>
<field name="circle_count" type="uint8"/>
<field name="oval_count" type="uint8"/>
</message>
@@ -340,8 +340,8 @@ printf("gps_utm_zone %d\n", gps_utm_zone);
0, // cur_stage
0, // pos_x
0, // pos_y
0, // dist2_wp
0, // dist2_home
0, // dist_wp
0, // dist_home
0, // circle_count
0); // oval_count