mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-30 13:40:35 +08:00
Add default initializers and timestamp in local position
This commit is contained in:
@@ -1430,7 +1430,7 @@ protected:
|
||||
struct position_setpoint_triplet_s pos_sp_triplet;
|
||||
|
||||
if (_pos_sp_triplet_sub->update(&pos_sp_triplet)) {
|
||||
mavlink_position_target_global_int_t msg;
|
||||
mavlink_position_target_global_int_t msg{};
|
||||
|
||||
msg.coordinate_frame = MAV_FRAME_GLOBAL;
|
||||
msg.lat_int = pos_sp_triplet.current.lat * 1e7;
|
||||
@@ -1490,8 +1490,9 @@ protected:
|
||||
struct vehicle_local_position_setpoint_s pos_sp;
|
||||
|
||||
if (_pos_sp_sub->update(&_pos_sp_time, &pos_sp)) {
|
||||
mavlink_position_target_local_ned_t msg;
|
||||
mavlink_position_target_local_ned_t msg{};
|
||||
|
||||
msg.time_boot_ms = pos_sp.timestamp / 1000;
|
||||
msg.coordinate_frame = MAV_FRAME_LOCAL_NED;
|
||||
msg.x = pos_sp.x;
|
||||
msg.y = pos_sp.y;
|
||||
@@ -1558,7 +1559,7 @@ protected:
|
||||
struct vehicle_rates_setpoint_s att_rates_sp;
|
||||
(void)_att_rates_sp_sub->update(&_att_rates_sp_time, &att_rates_sp);
|
||||
|
||||
mavlink_attitude_target_t msg;
|
||||
mavlink_attitude_target_t msg{};
|
||||
|
||||
msg.time_boot_ms = att_sp.timestamp / 1000;
|
||||
mavlink_euler_to_quaternion(att_sp.roll_body, att_sp.pitch_body, att_sp.yaw_body, msg.q);
|
||||
|
||||
@@ -788,6 +788,7 @@ MulticopterPositionControl::task_main()
|
||||
}
|
||||
|
||||
/* fill local position setpoint */
|
||||
_local_pos_sp.timestamp = hrt_absolute_time();
|
||||
_local_pos_sp.x = _pos_sp(0);
|
||||
_local_pos_sp.y = _pos_sp(1);
|
||||
_local_pos_sp.z = _pos_sp(2);
|
||||
|
||||
@@ -50,11 +50,12 @@
|
||||
*/
|
||||
|
||||
struct vehicle_local_position_setpoint_s {
|
||||
uint64_t timestamp; /**< timestamp of the setpoint */
|
||||
float x; /**< in meters NED */
|
||||
float y; /**< in meters NED */
|
||||
float z; /**< in meters NED */
|
||||
float yaw; /**< in radians NED -PI..+PI */
|
||||
}; /**< Local position in NED frame to go to */
|
||||
}; /**< Local position in NED frame */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
Reference in New Issue
Block a user