mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-07 17:35:22 +08:00
astyle src/modules/vtol_att_control
This commit is contained in:
committed by
Lorenz Meier
parent
380819dfc5
commit
a0271fe020
@@ -246,14 +246,14 @@ void Tailsitter::update_transition_state()
|
||||
/** create time dependant pitch angle set point + 0.2 rad overlap over the switch value*/
|
||||
_v_att_sp->pitch_body = _pitch_transition_start - (fabsf(PITCH_TRANSITION_FRONT_P1 - _pitch_transition_start) *
|
||||
(float)hrt_elapsed_time(&_vtol_schedule.transition_start) / (_params_tailsitter.front_trans_dur * 1000000.0f));
|
||||
_v_att_sp->pitch_body = math::constrain(_v_att_sp->pitch_body , PITCH_TRANSITION_FRONT_P1 - 0.2f ,
|
||||
_v_att_sp->pitch_body = math::constrain(_v_att_sp->pitch_body, PITCH_TRANSITION_FRONT_P1 - 0.2f,
|
||||
_pitch_transition_start);
|
||||
|
||||
/** create time dependant throttle signal higher than in MC and growing untill P2 switch speed reached */
|
||||
if (_airspeed->indicated_airspeed_m_s <= _params_tailsitter.airspeed_trans) {
|
||||
_thrust_transition = _thrust_transition_start + (fabsf(THROTTLE_TRANSITION_MAX * _thrust_transition_start) *
|
||||
(float)hrt_elapsed_time(&_vtol_schedule.transition_start) / (_params_tailsitter.front_trans_dur * 1000000.0f));
|
||||
_thrust_transition = math::constrain(_thrust_transition , _thrust_transition_start ,
|
||||
_thrust_transition = math::constrain(_thrust_transition, _thrust_transition_start,
|
||||
(1.0f + THROTTLE_TRANSITION_MAX) * _thrust_transition_start);
|
||||
_v_att_sp->thrust = _thrust_transition;
|
||||
}
|
||||
@@ -316,7 +316,7 @@ void Tailsitter::update_transition_state()
|
||||
/** create time dependant pitch angle set point stating at -pi/2 + 0.2 rad overlap over the switch value*/
|
||||
_v_att_sp->pitch_body = M_PI_2_F + _pitch_transition_start + fabsf(PITCH_TRANSITION_BACK + 1.57f) *
|
||||
(float)hrt_elapsed_time(&_vtol_schedule.transition_start) / (_params_tailsitter.back_trans_dur * 1000000.0f);
|
||||
_v_att_sp->pitch_body = math::constrain(_v_att_sp->pitch_body , -2.0f , PITCH_TRANSITION_BACK + 0.2f);
|
||||
_v_att_sp->pitch_body = math::constrain(_v_att_sp->pitch_body, -2.0f, PITCH_TRANSITION_BACK + 0.2f);
|
||||
|
||||
// throttle value is decreesed
|
||||
_v_att_sp->thrust = _thrust_transition_start * 0.9f;
|
||||
|
||||
@@ -236,7 +236,7 @@ void VtolAttitudeControl::actuator_controls_mc_poll()
|
||||
orb_check(_actuator_inputs_mc, &updated);
|
||||
|
||||
if (updated) {
|
||||
orb_copy(ORB_ID(actuator_controls_virtual_mc), _actuator_inputs_mc , &_actuators_mc_in);
|
||||
orb_copy(ORB_ID(actuator_controls_virtual_mc), _actuator_inputs_mc, &_actuators_mc_in);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ void VtolAttitudeControl::actuator_controls_fw_poll()
|
||||
orb_check(_actuator_inputs_fw, &updated);
|
||||
|
||||
if (updated) {
|
||||
orb_copy(ORB_ID(actuator_controls_virtual_fw), _actuator_inputs_fw , &_actuators_fw_in);
|
||||
orb_copy(ORB_ID(actuator_controls_virtual_fw), _actuator_inputs_fw, &_actuators_fw_in);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ void VtolAttitudeControl::vehicle_rates_sp_mc_poll()
|
||||
orb_check(_mc_virtual_v_rates_sp_sub, &updated);
|
||||
|
||||
if (updated) {
|
||||
orb_copy(ORB_ID(mc_virtual_rates_setpoint), _mc_virtual_v_rates_sp_sub , &_mc_virtual_v_rates_sp);
|
||||
orb_copy(ORB_ID(mc_virtual_rates_setpoint), _mc_virtual_v_rates_sp_sub, &_mc_virtual_v_rates_sp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ void VtolAttitudeControl::vehicle_rates_sp_fw_poll()
|
||||
orb_check(_fw_virtual_v_rates_sp_sub, &updated);
|
||||
|
||||
if (updated) {
|
||||
orb_copy(ORB_ID(fw_virtual_rates_setpoint), _fw_virtual_v_rates_sp_sub , &_fw_virtual_v_rates_sp);
|
||||
orb_copy(ORB_ID(fw_virtual_rates_setpoint), _fw_virtual_v_rates_sp_sub, &_fw_virtual_v_rates_sp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ VtolAttitudeControl::vehicle_airspeed_poll()
|
||||
orb_check(_airspeed_sub, &updated);
|
||||
|
||||
if (updated) {
|
||||
orb_copy(ORB_ID(airspeed), _airspeed_sub , &_airspeed);
|
||||
orb_copy(ORB_ID(airspeed), _airspeed_sub, &_airspeed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ VtolAttitudeControl::vehicle_battery_poll()
|
||||
orb_check(_battery_status_sub, &updated);
|
||||
|
||||
if (updated) {
|
||||
orb_copy(ORB_ID(battery_status), _battery_status_sub , &_batt_status);
|
||||
orb_copy(ORB_ID(battery_status), _battery_status_sub, &_batt_status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ VtolAttitudeControl::vehicle_local_pos_poll()
|
||||
orb_check(_local_pos_sub, &updated);
|
||||
|
||||
if (updated) {
|
||||
orb_copy(ORB_ID(vehicle_local_position), _local_pos_sub , &_local_pos);
|
||||
orb_copy(ORB_ID(vehicle_local_position), _local_pos_sub, &_local_pos);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -382,7 +382,7 @@ VtolAttitudeControl::mc_virtual_att_sp_poll()
|
||||
orb_check(_mc_virtual_att_sp_sub, &updated);
|
||||
|
||||
if (updated) {
|
||||
orb_copy(ORB_ID(mc_virtual_attitude_setpoint), _mc_virtual_att_sp_sub , &_mc_virtual_att_sp);
|
||||
orb_copy(ORB_ID(mc_virtual_attitude_setpoint), _mc_virtual_att_sp_sub, &_mc_virtual_att_sp);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -398,7 +398,7 @@ VtolAttitudeControl::fw_virtual_att_sp_poll()
|
||||
orb_check(_fw_virtual_att_sp_sub, &updated);
|
||||
|
||||
if (updated) {
|
||||
orb_copy(ORB_ID(fw_virtual_attitude_setpoint), _fw_virtual_att_sp_sub , &_fw_virtual_att_sp);
|
||||
orb_copy(ORB_ID(fw_virtual_attitude_setpoint), _fw_virtual_att_sp_sub, &_fw_virtual_att_sp);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -413,7 +413,7 @@ VtolAttitudeControl::vehicle_cmd_poll()
|
||||
orb_check(_vehicle_cmd_sub, &updated);
|
||||
|
||||
if (updated) {
|
||||
orb_copy(ORB_ID(vehicle_command), _vehicle_cmd_sub , &_vehicle_cmd);
|
||||
orb_copy(ORB_ID(vehicle_command), _vehicle_cmd_sub, &_vehicle_cmd);
|
||||
handle_command();
|
||||
}
|
||||
}
|
||||
@@ -429,7 +429,7 @@ VtolAttitudeControl::tecs_status_poll()
|
||||
orb_check(_tecs_status_sub, &updated);
|
||||
|
||||
if (updated) {
|
||||
orb_copy(ORB_ID(tecs_status), _tecs_status_sub , &_tecs_status);
|
||||
orb_copy(ORB_ID(tecs_status), _tecs_status_sub, &_tecs_status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ VtolAttitudeControl::land_detected_poll()
|
||||
orb_check(_land_detected_sub, &updated);
|
||||
|
||||
if (updated) {
|
||||
orb_copy(ORB_ID(vehicle_land_detected), _land_detected_sub , &_land_detected);
|
||||
orb_copy(ORB_ID(vehicle_land_detected), _land_detected_sub, &_land_detected);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user