mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-30 03:27:33 +08:00
[rotorcraft] gps_sim_hitl: set gps alt and hmsl
now the simple HITL should work with ins gps_passthrough
This commit is contained in:
@@ -28,7 +28,7 @@
|
|||||||
#define GPS_SIM_HITL_H
|
#define GPS_SIM_HITL_H
|
||||||
|
|
||||||
#include "std.h"
|
#include "std.h"
|
||||||
#include "subsystems/ins.h"
|
#include "state.h"
|
||||||
#include "guidance/guidance_h.h"
|
#include "guidance/guidance_h.h"
|
||||||
#include "guidance/guidance_v.h"
|
#include "guidance/guidance_v.h"
|
||||||
|
|
||||||
@@ -40,9 +40,7 @@ extern uint32_t gps_sim_hitl_timer;
|
|||||||
SysTimeTimerStart(gps_sim_hitl_timer); \
|
SysTimeTimerStart(gps_sim_hitl_timer); \
|
||||||
gps.last_msg_ticks = sys_time.nb_sec_rem; \
|
gps.last_msg_ticks = sys_time.nb_sec_rem; \
|
||||||
gps.last_msg_time = sys_time.nb_sec; \
|
gps.last_msg_time = sys_time.nb_sec; \
|
||||||
if (ins_impl.ltp_initialized) { \
|
if (state.ned_initialized_i) { \
|
||||||
struct NedCoor_i ned_coor; \
|
|
||||||
struct NedCoor_i ned_vel; \
|
|
||||||
if (!autopilot_in_flight) { \
|
if (!autopilot_in_flight) { \
|
||||||
struct Int32Vect2 zero_vector; \
|
struct Int32Vect2 zero_vector; \
|
||||||
INT_VECT2_ZERO(zero_vector); \
|
INT_VECT2_ZERO(zero_vector); \
|
||||||
@@ -55,14 +53,17 @@ extern uint32_t gps_sim_hitl_timer;
|
|||||||
guidance_v_zd_ref = 0; \
|
guidance_v_zd_ref = 0; \
|
||||||
guidance_v_zdd_ref = 0; \
|
guidance_v_zdd_ref = 0; \
|
||||||
} \
|
} \
|
||||||
VECT3_ASSIGN(ned_coor, guidance_h_pos_ref.x * INT32_POS_OF_CM_DEN / INT32_POS_OF_CM_NUM, \
|
struct NedCoor_i ned_c; \
|
||||||
guidance_h_pos_ref.y * INT32_POS_OF_CM_DEN / INT32_POS_OF_CM_NUM, \
|
ned_c.x = guidance_h_pos_ref.x * INT32_POS_OF_CM_DEN / INT32_POS_OF_CM_NUM; \
|
||||||
guidance_v_z_ref * INT32_POS_OF_CM_DEN / INT32_POS_OF_CM_NUM); \
|
ned_c.y = guidance_h_pos_ref.y * INT32_POS_OF_CM_DEN / INT32_POS_OF_CM_NUM; \
|
||||||
VECT3_ASSIGN(ned_vel, guidance_h_speed_ref.x * INT32_SPEED_OF_CM_S_DEN / INT32_SPEED_OF_CM_S_NUM, \
|
ned_c.z = guidance_v_z_ref * INT32_POS_OF_CM_DEN / INT32_POS_OF_CM_NUM; \
|
||||||
guidance_h_speed_ref.y * INT32_SPEED_OF_CM_S_DEN / INT32_SPEED_OF_CM_S_NUM, \
|
ecef_of_ned_point_i(&gps.ecef_pos, &state.ned_origin_i, &ned_c); \
|
||||||
guidance_v_zd_ref * INT32_SPEED_OF_CM_S_DEN / INT32_SPEED_OF_CM_S_NUM); \
|
gps.lla_pos.alt = state.ned_origin_i.lla.alt - ned_c.z; \
|
||||||
ecef_of_ned_point_i(&gps.ecef_pos, &ins_impl.ltp_def, &ned_coor); \
|
gps.hmsl = state.ned_origin_i.hmsl - ned_c.z; \
|
||||||
ecef_of_ned_vect_i(&gps.ecef_vel, &ins_impl.ltp_def, &ned_vel); \
|
ned_c.x = guidance_h_speed_ref.x * INT32_SPEED_OF_CM_S_DEN / INT32_SPEED_OF_CM_S_NUM; \
|
||||||
|
ned_c.y = guidance_h_speed_ref.y * INT32_SPEED_OF_CM_S_DEN / INT32_SPEED_OF_CM_S_NUM; \
|
||||||
|
ned_c.z = guidance_v_zd_ref * INT32_SPEED_OF_CM_S_DEN / INT32_SPEED_OF_CM_S_NUM; \
|
||||||
|
ecef_of_ned_vect_i(&gps.ecef_vel, &state.ned_origin_i, &ned_c); \
|
||||||
gps.fix = GPS_FIX_3D; \
|
gps.fix = GPS_FIX_3D; \
|
||||||
gps.last_3dfix_ticks = sys_time.nb_sec_rem; \
|
gps.last_3dfix_ticks = sys_time.nb_sec_rem; \
|
||||||
gps.last_3dfix_time = sys_time.nb_sec; \
|
gps.last_3dfix_time = sys_time.nb_sec; \
|
||||||
|
|||||||
Reference in New Issue
Block a user