mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 16:53:34 +08:00
improve end to end control latency measurement (#9388)
This commit is contained in:
@@ -398,7 +398,8 @@ void Standard::update_fw_state()
|
||||
void Standard::fill_actuator_outputs()
|
||||
{
|
||||
// multirotor controls
|
||||
_actuators_out_0->timestamp = _actuators_mc_in->timestamp;
|
||||
_actuators_out_0->timestamp = hrt_absolute_time();
|
||||
_actuators_out_0->timestamp_sample = _actuators_mc_in->timestamp_sample;
|
||||
|
||||
// roll
|
||||
_actuators_out_0->control[actuator_controls_s::INDEX_ROLL] =
|
||||
@@ -415,7 +416,8 @@ void Standard::fill_actuator_outputs()
|
||||
|
||||
|
||||
// fixed wing controls
|
||||
_actuators_out_1->timestamp = _actuators_fw_in->timestamp;
|
||||
_actuators_out_1->timestamp = hrt_absolute_time();
|
||||
_actuators_out_1->timestamp_sample = _actuators_fw_in->timestamp_sample;
|
||||
|
||||
if (_vtol_schedule.flight_mode != MC_MODE) {
|
||||
// roll
|
||||
|
||||
@@ -271,9 +271,14 @@ void Tailsitter::update_fw_state()
|
||||
*/
|
||||
void Tailsitter::fill_actuator_outputs()
|
||||
{
|
||||
_actuators_out_0->timestamp = hrt_absolute_time();
|
||||
_actuators_out_0->timestamp_sample = _actuators_mc_in->timestamp_sample;
|
||||
|
||||
_actuators_out_1->timestamp = hrt_absolute_time();
|
||||
_actuators_out_1->timestamp_sample = _actuators_fw_in->timestamp_sample;
|
||||
|
||||
switch (_vtol_mode) {
|
||||
case ROTARY_WING:
|
||||
_actuators_out_0->timestamp = _actuators_mc_in->timestamp;
|
||||
_actuators_out_0->control[actuator_controls_s::INDEX_ROLL] = _actuators_mc_in->control[actuator_controls_s::INDEX_ROLL];
|
||||
_actuators_out_0->control[actuator_controls_s::INDEX_PITCH] =
|
||||
_actuators_mc_in->control[actuator_controls_s::INDEX_PITCH];
|
||||
@@ -281,8 +286,6 @@ void Tailsitter::fill_actuator_outputs()
|
||||
_actuators_out_0->control[actuator_controls_s::INDEX_THROTTLE] =
|
||||
_actuators_mc_in->control[actuator_controls_s::INDEX_THROTTLE];
|
||||
|
||||
_actuators_out_1->timestamp = _actuators_mc_in->timestamp;
|
||||
|
||||
if (_params->elevons_mc_lock) {
|
||||
_actuators_out_1->control[0] = 0;
|
||||
_actuators_out_1->control[1] = 0;
|
||||
@@ -299,7 +302,6 @@ void Tailsitter::fill_actuator_outputs()
|
||||
|
||||
case FIXED_WING:
|
||||
// in fixed wing mode we use engines only for providing thrust, no moments are generated
|
||||
_actuators_out_0->timestamp = _actuators_fw_in->timestamp;
|
||||
_actuators_out_0->control[actuator_controls_s::INDEX_ROLL] = 0;
|
||||
_actuators_out_0->control[actuator_controls_s::INDEX_PITCH] = 0;
|
||||
_actuators_out_0->control[actuator_controls_s::INDEX_YAW] = 0;
|
||||
@@ -319,8 +321,6 @@ void Tailsitter::fill_actuator_outputs()
|
||||
case TRANSITION_TO_FW:
|
||||
case TRANSITION_TO_MC:
|
||||
// in transition engines are mixed by weight (BACK TRANSITION ONLY)
|
||||
_actuators_out_0->timestamp = _actuators_mc_in->timestamp;
|
||||
_actuators_out_1->timestamp = _actuators_mc_in->timestamp;
|
||||
_actuators_out_0->control[actuator_controls_s::INDEX_ROLL] = _actuators_mc_in->control[actuator_controls_s::INDEX_ROLL]
|
||||
* _mc_roll_weight;
|
||||
_actuators_out_0->control[actuator_controls_s::INDEX_PITCH] =
|
||||
|
||||
@@ -336,7 +336,9 @@ void Tiltrotor::waiting_on_tecs()
|
||||
*/
|
||||
void Tiltrotor::fill_actuator_outputs()
|
||||
{
|
||||
_actuators_out_0->timestamp = _actuators_mc_in->timestamp;
|
||||
_actuators_out_0->timestamp = hrt_absolute_time();
|
||||
_actuators_out_0->timestamp_sample = _actuators_mc_in->timestamp_sample;
|
||||
|
||||
_actuators_out_0->control[actuator_controls_s::INDEX_ROLL] = _actuators_mc_in->control[actuator_controls_s::INDEX_ROLL]
|
||||
* _mc_roll_weight;
|
||||
_actuators_out_0->control[actuator_controls_s::INDEX_PITCH] =
|
||||
@@ -359,7 +361,9 @@ void Tiltrotor::fill_actuator_outputs()
|
||||
_actuators_mc_in->control[actuator_controls_s::INDEX_THROTTLE];
|
||||
}
|
||||
|
||||
_actuators_out_1->timestamp = _actuators_fw_in->timestamp;
|
||||
_actuators_out_1->timestamp = hrt_absolute_time();
|
||||
_actuators_out_1->timestamp_sample = _actuators_fw_in->timestamp_sample;
|
||||
|
||||
_actuators_out_1->control[actuator_controls_s::INDEX_ROLL] =
|
||||
-_actuators_fw_in->control[actuator_controls_s::INDEX_ROLL];
|
||||
_actuators_out_1->control[actuator_controls_s::INDEX_PITCH] =
|
||||
|
||||
Reference in New Issue
Block a user