mavlink: add npfg_status, regenerate headers

This commit is contained in:
Thomas Stastny
2021-08-24 15:24:31 +02:00
committed by JaeyoungLim
parent d240ee9448
commit 0b705c6c6d
5 changed files with 106 additions and 2 deletions
@@ -515,6 +515,8 @@ FixedwingPositionControl::status_publish()
npfg_status.time_const = 0.0f;
}
npfg_status.timestamp = hrt_absolute_time();
_pos_ctrl_status_pub.publish(pos_ctrl_status);
_npfg_status_pub.publish(npfg_status);
}
+3
View File
@@ -1528,6 +1528,7 @@ Mavlink::configure_streams_to_default(const char *configure_single_stream)
configure_stream_local("HOME_POSITION", 0.5f);
configure_stream_local("LOCAL_POSITION_NED", 1.0f);
configure_stream_local("NAV_CONTROLLER_OUTPUT", 1.0f);
configure_stream_local("NPFG_STATUS", 1.0f);
configure_stream_local("OBSTACLE_DISTANCE", 1.0f);
configure_stream_local("ORBIT_EXECUTION_STATUS", 2.0f);
configure_stream_local("PING", 0.1f);
@@ -1587,6 +1588,7 @@ Mavlink::configure_streams_to_default(const char *configure_single_stream)
configure_stream_local("GPS_STATUS", 1.0f);
configure_stream_local("HOME_POSITION", 0.5f);
configure_stream_local("NAV_CONTROLLER_OUTPUT", 10.0f);
configure_stream_local("NPFG_STATUS", 10.0f);
configure_stream_local("OPTICAL_FLOW_RAD", 10.0f);
configure_stream_local("ORBIT_EXECUTION_STATUS", 5.0f);
configure_stream_local("PING", 1.0f);
@@ -1729,6 +1731,7 @@ Mavlink::configure_streams_to_default(const char *configure_single_stream)
configure_stream_local("HOME_POSITION", 0.5f);
configure_stream_local("MANUAL_CONTROL", 5.0f);
configure_stream_local("NAV_CONTROLLER_OUTPUT", 10.0f);
configure_stream_local("NPFG_STATUS", 10.0f);
configure_stream_local("OPTICAL_FLOW_RAD", 10.0f);
configure_stream_local("ORBIT_EXECUTION_STATUS", 5.0f);
configure_stream_local("PING", 1.0f);
+5 -1
View File
@@ -88,6 +88,7 @@
#include "streams/MANUAL_CONTROL.hpp"
#include "streams/MOUNT_ORIENTATION.hpp"
#include "streams/NAV_CONTROLLER_OUTPUT.hpp"
#include "streams/NPFG_STATUS.hpp"
#include "streams/OBSTACLE_DISTANCE.hpp"
#include "streams/OPTICAL_FLOW_RAD.hpp"
#include "streams/ORBIT_EXECUTION_STATUS.hpp"
@@ -533,8 +534,11 @@ static const StreamListItem streams_list[] = {
create_stream_list_item<MavlinkStreamComponentInformation>(),
#endif // COMPONENT_INFORMATION_HPP
#if defined(RAW_RPM_HPP)
create_stream_list_item<MavlinkStreamRawRpm>()
create_stream_list_item<MavlinkStreamRawRpm>(),
#endif // RAW_RPM_HPP
#if defined(NPFG_STATUS_HPP)
create_stream_list_item<MavlinkStreamNPFGStatus>()
#endif // NPFG_STATUS
};
const char *get_stream_name(const uint16_t msg_id)
@@ -0,0 +1,95 @@
/****************************************************************************
*
* Copyright (c) 2021 Autonomous Systems Lab, ETH Zurich. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef NPFG_STATUS_HPP
#define NPFG_STATUS_HPP
#include <uORB/topics/npfg_status.h>
class MavlinkStreamNPFGStatus : public MavlinkStream
{
public:
static MavlinkStream *new_instance(Mavlink *mavlink) { return new MavlinkStreamNPFGStatus(mavlink); }
static constexpr const char *get_name_static() { return "NPFG_STATUS"; }
static constexpr uint16_t get_id_static() { return MAVLINK_MSG_ID_NPFG_STATUS; }
const char *get_name() const override { return get_name_static(); }
uint16_t get_id() override { return get_id_static(); }
unsigned get_size() override
{
if (_npfg_status_sub.advertised()) {
return MAVLINK_MSG_ID_NPFG_STATUS_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
}
return 0;
}
private:
explicit MavlinkStreamNPFGStatus(Mavlink *mavlink) : MavlinkStream(mavlink) {}
uORB::Subscription _npfg_status_sub{ORB_ID(npfg_status)};
bool send() override
{
struct npfg_status_s npfg_status;
if (_npfg_status_sub.update(&npfg_status)) {
mavlink_npfg_status_t msg{};
msg.timestamp = npfg_status.timestamp;
msg.lat_accel = npfg_status.lat_accel;
msg.lat_accel_ff = npfg_status.lat_accel_ff;
msg.bearing_feas = npfg_status.bearing_feas;
msg.bearing_feas_on_track = npfg_status.bearing_feas_on_track;
msg.signed_track_error = npfg_status.signed_track_error;
msg.track_error_bound = npfg_status.track_error_bound;
msg.airspeed_ref = npfg_status.airspeed_ref;
msg.bearing = math::degrees(npfg_status.bearing);
msg.heading_ref = math::degrees(npfg_status.heading_ref);
msg.min_ground_speed_ref = npfg_status.min_ground_speed_ref;
msg.adapted_period = npfg_status.adapted_period;
msg.p_gain = npfg_status.p_gain;
msg.time_const = npfg_status.time_const;
mavlink_msg_npfg_status_send_struct(_mavlink->get_channel(), &msg);
return true;
}
return false;
}
};
#endif // NPFG_STATUS