Browse Source

PositionControl: make getters const functions

sbg
Matthias Grob 5 years ago
parent
commit
d0084766ff
  1. 4
      src/modules/mc_pos_control/PositionControl/PositionControl.cpp
  2. 6
      src/modules/mc_pos_control/PositionControl/PositionControl.hpp

4
src/modules/mc_pos_control/PositionControl/PositionControl.cpp

@ -351,7 +351,7 @@ void PositionControl::updateConstraints(const vehicle_constraints_s &constraints
} }
} }
void PositionControl::getLocalPositionSetpoint(vehicle_local_position_setpoint_s &local_position_setpoint) void PositionControl::getLocalPositionSetpoint(vehicle_local_position_setpoint_s &local_position_setpoint) const
{ {
local_position_setpoint.x = _pos_sp(0); local_position_setpoint.x = _pos_sp(0);
local_position_setpoint.y = _pos_sp(1); local_position_setpoint.y = _pos_sp(1);
@ -365,7 +365,7 @@ void PositionControl::getLocalPositionSetpoint(vehicle_local_position_setpoint_s
_thr_sp.copyTo(local_position_setpoint.thrust); _thr_sp.copyTo(local_position_setpoint.thrust);
} }
void PositionControl::getAttitudeSetpoint(vehicle_attitude_setpoint_s &attitude_setpoint) void PositionControl::getAttitudeSetpoint(vehicle_attitude_setpoint_s &attitude_setpoint) const
{ {
attitude_setpoint = ControlMath::thrustToAttitude(_thr_sp, _yaw_sp); attitude_setpoint = ControlMath::thrustToAttitude(_thr_sp, _yaw_sp);
attitude_setpoint.yaw_sp_move_rate = _yawspeed_sp; attitude_setpoint.yaw_sp_move_rate = _yawspeed_sp;

6
src/modules/mc_pos_control/PositionControl/PositionControl.hpp

@ -134,7 +134,7 @@ public:
* @see _vel_sp * @see _vel_sp
* @return The velocity set-point that was executed in the control-loop. Nan if velocity control-loop was skipped. * @return The velocity set-point that was executed in the control-loop. Nan if velocity control-loop was skipped.
*/ */
const matrix::Vector3f getVelSp() const matrix::Vector3f getVelSp() const
{ {
matrix::Vector3f vel_sp{}; matrix::Vector3f vel_sp{};
@ -156,7 +156,7 @@ public:
* The acceleration or thrust setpoints can be used for attitude control. * The acceleration or thrust setpoints can be used for attitude control.
* @param local_position_setpoint reference to struct to fill up * @param local_position_setpoint reference to struct to fill up
*/ */
void getLocalPositionSetpoint(vehicle_local_position_setpoint_s &local_position_setpoint); void getLocalPositionSetpoint(vehicle_local_position_setpoint_s &local_position_setpoint) const;
/** /**
* Get the controllers output attitude setpoint * Get the controllers output attitude setpoint
@ -164,7 +164,7 @@ public:
* It needs to be executed by the attitude controller to achieve velocity and position tracking. * It needs to be executed by the attitude controller to achieve velocity and position tracking.
* @param attitude_setpoint reference to struct to fill up * @param attitude_setpoint reference to struct to fill up
*/ */
void getAttitudeSetpoint(vehicle_attitude_setpoint_s &attitude_setpoint); void getAttitudeSetpoint(vehicle_attitude_setpoint_s &attitude_setpoint) const;
protected: protected:

Loading…
Cancel
Save