mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-23 11:07:36 +08:00
delete systemcmds/motor_test and msg/test_motor.msg
This commit is contained in:
@@ -1228,10 +1228,6 @@ Commander::handle_command(const vehicle_command_s &cmd)
|
||||
|
||||
break;
|
||||
|
||||
case vehicle_command_s::VEHICLE_CMD_DO_MOTOR_TEST:
|
||||
cmd_result = handle_command_motor_test(cmd);
|
||||
break;
|
||||
|
||||
case vehicle_command_s::VEHICLE_CMD_ACTUATOR_TEST:
|
||||
cmd_result = handle_command_actuator_test(cmd);
|
||||
break;
|
||||
@@ -1538,54 +1534,6 @@ Commander::handle_command(const vehicle_command_s &cmd)
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned
|
||||
Commander::handle_command_motor_test(const vehicle_command_s &cmd)
|
||||
{
|
||||
if (_arm_state_machine.isArmed() || (_safety.isButtonAvailable() && !_safety.isSafetyOff())) {
|
||||
return vehicle_command_ack_s::VEHICLE_CMD_RESULT_DENIED;
|
||||
}
|
||||
|
||||
if (_param_com_mot_test_en.get() != 1) {
|
||||
return vehicle_command_ack_s::VEHICLE_CMD_RESULT_DENIED;
|
||||
}
|
||||
|
||||
test_motor_s test_motor{};
|
||||
test_motor.timestamp = hrt_absolute_time();
|
||||
test_motor.motor_number = (int)(cmd.param1 + 0.5f) - 1;
|
||||
|
||||
int throttle_type = (int)(cmd.param2 + 0.5f);
|
||||
|
||||
if (throttle_type != 0) { // 0: MOTOR_TEST_THROTTLE_PERCENT
|
||||
return vehicle_command_ack_s::VEHICLE_CMD_RESULT_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int motor_count = (int)(cmd.param5 + 0.5);
|
||||
|
||||
if (motor_count > 1) {
|
||||
return vehicle_command_ack_s::VEHICLE_CMD_RESULT_UNSUPPORTED;
|
||||
}
|
||||
|
||||
test_motor.action = test_motor_s::ACTION_RUN;
|
||||
test_motor.value = math::constrain(cmd.param3 / 100.f, 0.f, 1.f);
|
||||
|
||||
if (test_motor.value < FLT_EPSILON) {
|
||||
// the message spec is not clear on whether 0 means stop, but it should be closer to what a user expects
|
||||
test_motor.value = -1.f;
|
||||
}
|
||||
|
||||
test_motor.timeout_ms = (int)(cmd.param4 * 1000.f + 0.5f);
|
||||
|
||||
// enforce a timeout and a maximum limit
|
||||
if (test_motor.timeout_ms == 0 || test_motor.timeout_ms > 3000) {
|
||||
test_motor.timeout_ms = 3000;
|
||||
}
|
||||
|
||||
test_motor.driver_instance = 0; // the mavlink command does not allow to specify the instance, so set to 0 for now
|
||||
_test_motor_pub.publish(test_motor);
|
||||
|
||||
return vehicle_command_ack_s::VEHICLE_CMD_RESULT_ACCEPTED;
|
||||
}
|
||||
|
||||
unsigned
|
||||
Commander::handle_command_actuator_test(const vehicle_command_s &cmd)
|
||||
{
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
#include <uORB/topics/actuator_armed.h>
|
||||
#include <uORB/topics/actuator_test.h>
|
||||
#include <uORB/topics/failure_detector_status.h>
|
||||
#include <uORB/topics/test_motor.h>
|
||||
#include <uORB/topics/vehicle_command_ack.h>
|
||||
#include <uORB/topics/vehicle_control_mode.h>
|
||||
#include <uORB/topics/vehicle_status.h>
|
||||
@@ -147,7 +146,6 @@ private:
|
||||
*/
|
||||
bool handle_command(const vehicle_command_s &cmd);
|
||||
|
||||
unsigned handle_command_motor_test(const vehicle_command_s &cmd);
|
||||
unsigned handle_command_actuator_test(const vehicle_command_s &cmd);
|
||||
|
||||
void executeActionRequest(const action_request_s &action_request);
|
||||
@@ -380,7 +378,6 @@ private:
|
||||
uORB::Publication<actuator_armed_s> _actuator_armed_pub{ORB_ID(actuator_armed)};
|
||||
uORB::Publication<commander_state_s> _commander_state_pub{ORB_ID(commander_state)};
|
||||
uORB::Publication<failure_detector_status_s> _failure_detector_status_pub{ORB_ID(failure_detector_status)};
|
||||
uORB::Publication<test_motor_s> _test_motor_pub{ORB_ID(test_motor)};
|
||||
uORB::Publication<actuator_test_s> _actuator_test_pub{ORB_ID(actuator_test)};
|
||||
uORB::Publication<vehicle_control_mode_s> _vehicle_control_mode_pub{ORB_ID(vehicle_control_mode)};
|
||||
uORB::Publication<vehicle_status_flags_s> _vehicle_status_flags_pub{ORB_ID(vehicle_status_flags)};
|
||||
|
||||
@@ -315,7 +315,7 @@ void LoggedTopics::add_debug_topics()
|
||||
add_topic_multi("satellite_info", 1000, 2);
|
||||
add_topic("mag_worker_data");
|
||||
add_topic("sensor_preflight_mag", 500);
|
||||
add_topic("test_motor", 500);
|
||||
add_topic("actuator_test", 500);
|
||||
}
|
||||
|
||||
void LoggedTopics::add_estimator_replay_topics()
|
||||
|
||||
Reference in New Issue
Block a user