mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 07:53:33 +08:00
PositionControl: add getter for output attitude setpoint
This commit is contained in:
@@ -365,6 +365,12 @@ void PositionControl::getLocalPositionSetpoint(vehicle_local_position_setpoint_s
|
||||
_thr_sp.copyTo(local_position_setpoint.thrust);
|
||||
}
|
||||
|
||||
void PositionControl::getAttitudeSetpoint(vehicle_attitude_setpoint_s &attitude_setpoint)
|
||||
{
|
||||
attitude_setpoint = ControlMath::thrustToAttitude(_thr_sp, _yaw_sp);
|
||||
attitude_setpoint.yaw_sp_move_rate = _yawspeed_sp;
|
||||
}
|
||||
|
||||
void PositionControl::updateParams()
|
||||
{
|
||||
ModuleParams::updateParams();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018 PX4 Development Team. All rights reserved.
|
||||
* Copyright (c) 2018 - 2019 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
#include <matrix/matrix/math.hpp>
|
||||
|
||||
#include <uORB/topics/vehicle_attitude_setpoint.h>
|
||||
#include <uORB/topics/vehicle_local_position.h>
|
||||
#include <uORB/topics/vehicle_local_position_setpoint.h>
|
||||
#include <uORB/topics/vehicle_constraints.h>
|
||||
@@ -128,13 +129,6 @@ public:
|
||||
*/
|
||||
void resetIntegralZ() { _thr_int(2) = 0.0f; }
|
||||
|
||||
/**
|
||||
* Get the
|
||||
* @see _yawspeed_sp
|
||||
* @return The yawspeed set-point member.
|
||||
*/
|
||||
const float &getYawspeedSetpoint() { return _yawspeed_sp; }
|
||||
|
||||
/**
|
||||
* Get the
|
||||
* @see _vel_sp
|
||||
@@ -164,6 +158,14 @@ public:
|
||||
*/
|
||||
void getLocalPositionSetpoint(vehicle_local_position_setpoint_s &local_position_setpoint);
|
||||
|
||||
/**
|
||||
* Get the controllers output attitude setpoint
|
||||
* This attitude setpoint was generated from the resulting acceleration setpoint after position and velocity control.
|
||||
* It needs to be executed by the attitude controller to achieve velocity and position tracking.
|
||||
* @param attitude_setpoint reference to struct to fill up
|
||||
*/
|
||||
void getAttitudeSetpoint(vehicle_attitude_setpoint_s &attitude_setpoint);
|
||||
|
||||
protected:
|
||||
|
||||
void updateParams() override;
|
||||
|
||||
Reference in New Issue
Block a user