mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-23 22:58:10 +08:00
PositionControl: use constant references instead of pass-by-value for structs
This commit is contained in:
@@ -71,7 +71,7 @@ PositionControl::PositionControl()
|
||||
_setParams();
|
||||
};
|
||||
|
||||
void PositionControl::updateState(const struct vehicle_local_position_s state, const Vector3f &vel_dot)
|
||||
void PositionControl::updateState(const vehicle_local_position_s &state, const Vector3f &vel_dot)
|
||||
{
|
||||
_pos = Vector3f(&state.x);
|
||||
_vel = Vector3f(&state.vx);
|
||||
@@ -79,7 +79,7 @@ void PositionControl::updateState(const struct vehicle_local_position_s state, c
|
||||
_vel_dot = vel_dot;
|
||||
}
|
||||
|
||||
void PositionControl::updateSetpoint(struct vehicle_local_position_setpoint_s setpoint)
|
||||
void PositionControl::updateSetpoint(const vehicle_local_position_setpoint_s &setpoint)
|
||||
{
|
||||
_pos_sp = Vector3f(&setpoint.x);
|
||||
_vel_sp = Vector3f(&setpoint.vx);
|
||||
|
||||
@@ -64,8 +64,8 @@ public:
|
||||
|
||||
~PositionControl() {};
|
||||
|
||||
void updateState(const struct vehicle_local_position_s state, const matrix::Vector3f &vel_dot);
|
||||
void updateSetpoint(struct vehicle_local_position_setpoint_s setpoint);
|
||||
void updateState(const vehicle_local_position_s &state, const matrix::Vector3f &vel_dot);
|
||||
void updateSetpoint(const vehicle_local_position_setpoint_s &setpoint);
|
||||
void updateConstraints(const Controller::Constraints &constraints);
|
||||
void generateThrustYawSetpoint(const float &dt);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user