mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 05:53:34 +08:00
Refactor: Name manual_control_setpoint the same way everywhere
This commit is contained in:
committed by
Daniel Agar
parent
c6dd8bfcd6
commit
e9eae1bd76
@@ -95,10 +95,10 @@ void UUVAttitudeControl::vehicle_control_mode_poll()
|
||||
void UUVAttitudeControl::manual_control_setpoint_poll()
|
||||
{
|
||||
bool updated = false;
|
||||
orb_check(_manual_control_sub, &updated);
|
||||
orb_check(_manual_control_setpoint_sub, &updated);
|
||||
|
||||
if (updated) {
|
||||
orb_copy(ORB_ID(manual_control_setpoint), _manual_control_sub, &_manual);
|
||||
orb_copy(ORB_ID(manual_control_setpoint), _manual_control_setpoint_sub, &_manual_control_setpoint);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ void UUVAttitudeControl::run()
|
||||
_local_pos_sub = orb_subscribe(ORB_ID(vehicle_local_position));
|
||||
_vcontrol_mode_sub = orb_subscribe(ORB_ID(vehicle_control_mode));
|
||||
|
||||
_manual_control_sub = orb_subscribe(ORB_ID(manual_control_setpoint));
|
||||
_manual_control_setpoint_sub = orb_subscribe(ORB_ID(manual_control_setpoint));
|
||||
|
||||
_sensor_combined_sub = orb_subscribe(ORB_ID(sensor_combined));
|
||||
|
||||
@@ -266,7 +266,7 @@ void UUVAttitudeControl::run()
|
||||
/* Setup of loop */
|
||||
fds[0].fd = _vehicle_attitude_sub;
|
||||
fds[0].events = POLLIN;
|
||||
fds[1].fd = _manual_control_sub;
|
||||
fds[1].fd = _manual_control_setpoint_sub;
|
||||
fds[1].events = POLLIN;
|
||||
fds[2].fd = _sensor_combined_sub;
|
||||
fds[2].events = POLLIN;
|
||||
@@ -337,11 +337,12 @@ void UUVAttitudeControl::run()
|
||||
if (fds[1].revents & POLLIN) {
|
||||
// This should be copied even if not in manual mode. Otherwise, the poll(...) call will keep
|
||||
// returning immediately and this loop will eat up resources.
|
||||
orb_copy(ORB_ID(manual_control_setpoint), _manual_control_sub, &_manual);
|
||||
orb_copy(ORB_ID(manual_control_setpoint), _manual_control_setpoint_sub, &_manual_control_setpoint);
|
||||
|
||||
if (_vcontrol_mode.flag_control_manual_enabled && !_vcontrol_mode.flag_control_rates_enabled) {
|
||||
/* manual/direct control */
|
||||
constrain_actuator_commands(_manual.y, -_manual.x, _manual.r, _manual.z);
|
||||
constrain_actuator_commands(_manual_control_setpoint.y, -_manual_control_setpoint.x,
|
||||
_manual_control_setpoint.r, _manual_control_setpoint.z);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -363,7 +364,7 @@ void UUVAttitudeControl::run()
|
||||
}
|
||||
|
||||
orb_unsubscribe(_vcontrol_mode_sub);
|
||||
orb_unsubscribe(_manual_control_sub);
|
||||
orb_unsubscribe(_manual_control_setpoint_sub);
|
||||
orb_unsubscribe(_vehicle_attitude_sub);
|
||||
orb_unsubscribe(_local_pos_sub);
|
||||
orb_unsubscribe(_sensor_combined_sub);
|
||||
|
||||
@@ -126,12 +126,12 @@ private:
|
||||
int _vehicle_attitude_sub{-1}; /**< control state subscription */
|
||||
int _angular_velocity_sub{-1}; /**< vehicle angular velocity subscription */
|
||||
int _local_pos_sub{-1}; /**< local position subscription */
|
||||
int _manual_control_sub{-1}; /**< notification of manual control updates */
|
||||
int _manual_control_setpoint_sub{-1}; /**< notification of manual control updates */
|
||||
int _vcontrol_mode_sub{-1}; /**< vehicle status subscription */
|
||||
int _sensor_combined_sub{-1}; /**< sensor combined subscription */
|
||||
|
||||
actuator_controls_s _actuators {}; /**< actuator control inputs */
|
||||
manual_control_setpoint_s _manual {}; /**< r/c channel data */
|
||||
manual_control_setpoint_s _manual_control_setpoint {}; /**< r/c channel data */
|
||||
vehicle_attitude_s _vehicle_attitude {}; /**< control state */
|
||||
vehicle_angular_velocity_s _angular_velocity{}; /**< angular velocity */
|
||||
vehicle_attitude_setpoint_s _vehicle_attitude_sp {};/**< vehicle attitude setpoint */
|
||||
|
||||
Reference in New Issue
Block a user