mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-15 01:11:35 +08:00
mavlink: move POSITION_TARGET_LOCAL_NED to separate streams header
- position type_mask
This commit is contained in:
committed by
Lorenz Meier
parent
6b1d02feb7
commit
672a1c90aa
@@ -121,6 +121,7 @@ using matrix::wrap_2pi;
|
||||
#include "streams/OPTICAL_FLOW_RAD.hpp"
|
||||
#include "streams/ORBIT_EXECUTION_STATUS.hpp"
|
||||
#include "streams/PING.hpp"
|
||||
#include "streams/POSITION_TARGET_LOCAL_NED.hpp"
|
||||
#include "streams/PROTOCOL_VERSION.hpp"
|
||||
#include "streams/RAW_RPM.hpp"
|
||||
#include "streams/RC_CHANNELS.hpp"
|
||||
@@ -3424,81 +3425,6 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class MavlinkStreamLocalPositionSetpoint : public MavlinkStream
|
||||
{
|
||||
public:
|
||||
const char *get_name() const override
|
||||
{
|
||||
return MavlinkStreamLocalPositionSetpoint::get_name_static();
|
||||
}
|
||||
|
||||
static constexpr const char *get_name_static()
|
||||
{
|
||||
return "POSITION_TARGET_LOCAL_NED";
|
||||
}
|
||||
|
||||
static constexpr uint16_t get_id_static()
|
||||
{
|
||||
return MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED;
|
||||
}
|
||||
|
||||
uint16_t get_id() override
|
||||
{
|
||||
return get_id_static();
|
||||
}
|
||||
|
||||
static MavlinkStream *new_instance(Mavlink *mavlink)
|
||||
{
|
||||
return new MavlinkStreamLocalPositionSetpoint(mavlink);
|
||||
}
|
||||
|
||||
unsigned get_size() override
|
||||
{
|
||||
return _pos_sp_sub.advertised() ? MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES : 0;
|
||||
}
|
||||
|
||||
private:
|
||||
uORB::Subscription _pos_sp_sub{ORB_ID(vehicle_local_position_setpoint)};
|
||||
|
||||
/* do not allow top copying this class */
|
||||
MavlinkStreamLocalPositionSetpoint(MavlinkStreamLocalPositionSetpoint &) = delete;
|
||||
MavlinkStreamLocalPositionSetpoint &operator = (const MavlinkStreamLocalPositionSetpoint &) = delete;
|
||||
|
||||
protected:
|
||||
explicit MavlinkStreamLocalPositionSetpoint(Mavlink *mavlink) : MavlinkStream(mavlink)
|
||||
{}
|
||||
|
||||
bool send() override
|
||||
{
|
||||
vehicle_local_position_setpoint_s pos_sp;
|
||||
|
||||
if (_pos_sp_sub.update(&pos_sp)) {
|
||||
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;
|
||||
msg.z = pos_sp.z;
|
||||
msg.yaw = pos_sp.yaw;
|
||||
msg.yaw_rate = pos_sp.yawspeed;
|
||||
msg.vx = pos_sp.vx;
|
||||
msg.vy = pos_sp.vy;
|
||||
msg.vz = pos_sp.vz;
|
||||
msg.afx = pos_sp.acceleration[0];
|
||||
msg.afy = pos_sp.acceleration[1];
|
||||
msg.afz = pos_sp.acceleration[2];
|
||||
|
||||
mavlink_msg_position_target_local_ned_send_struct(_mavlink->get_channel(), &msg);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
class MavlinkStreamCameraCapture : public MavlinkStream
|
||||
{
|
||||
public:
|
||||
@@ -3611,7 +3537,9 @@ static const StreamListItem streams_list[] = {
|
||||
create_stream_list_item<MavlinkStreamServoOutputRaw<1> >(),
|
||||
create_stream_list_item<MavlinkStreamHILActuatorControls>(),
|
||||
create_stream_list_item<MavlinkStreamPositionTargetGlobalInt>(),
|
||||
create_stream_list_item<MavlinkStreamLocalPositionSetpoint>(),
|
||||
#if defined(POSITION_TARGET_LOCAL_NED_HPP)
|
||||
create_stream_list_item<MavlinkStreamPositionTargetLocalNed>(),
|
||||
#endif // POSITION_TARGET_LOCAL_NED_HPP
|
||||
#if defined(ATTITUDE_TARGET_HPP)
|
||||
create_stream_list_item<MavlinkStreamAttitudeTarget>(),
|
||||
#endif // ATTITUDE_TARGET_HPP
|
||||
|
||||
Reference in New Issue
Block a user