mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-28 16:14:08 +08:00
motor_ramp: add documentation
This commit is contained in:
parent
3a880a09d6
commit
4839ed8498
@ -33,7 +33,6 @@
|
||||
|
||||
/**
|
||||
* @file motor_ramp.cpp
|
||||
* Application to test motor ramp up.
|
||||
*
|
||||
* @author Andreas Antener <andreas@uaventure.com>
|
||||
* @author Roman Bapst <bapstroman@gmail.com>
|
||||
@ -41,6 +40,7 @@
|
||||
|
||||
#include <px4_config.h>
|
||||
#include <px4_defines.h>
|
||||
#include <px4_module.h>
|
||||
#include <px4_tasks.h>
|
||||
#include <px4_posix.h>
|
||||
#include <stdio.h>
|
||||
@ -113,14 +113,30 @@ usage(const char *reason)
|
||||
PX4_ERR("%s", reason);
|
||||
}
|
||||
|
||||
PX4_WARN("\n\nWARNING: motors will ramp up to full speed!\n\n"
|
||||
"Usage: motor_ramp <mode> <min_pwm> <time> [<max_pwm>]\n"
|
||||
"<mode> can be one of (ramp|sine|square)\n\n"
|
||||
"Example:\n"
|
||||
"sdlog2 on\n"
|
||||
"mc_att_control stop\n"
|
||||
"fw_att_control stop\n"
|
||||
"motor_ramp sine 1100 0.5\n");
|
||||
PRINT_MODULE_DESCRIPTION(
|
||||
R"DESCR_STR(
|
||||
### Description
|
||||
Application to test motor ramp up.
|
||||
|
||||
Before starting, make sure to stop any running attitude controller:
|
||||
$ mc_att_control stop
|
||||
$ fw_att_control stop
|
||||
|
||||
When starting, a background task is started, runs for several seconds (as specified), then exits.
|
||||
|
||||
Note: this command currently only supports the `/dev/pwm_output0` output.
|
||||
|
||||
### Example
|
||||
$ motor_ramp sine 1100 0.5
|
||||
)DESCR_STR");
|
||||
|
||||
|
||||
PRINT_MODULE_USAGE_NAME_SIMPLE("motor_ramp", "command");
|
||||
PRINT_MODULE_USAGE_ARG("ramp|sine|square", "mode", false);
|
||||
PRINT_MODULE_USAGE_ARG("<min_pwm> <time> [<max_pwm>]", "pwm value in us, time in sec", false);
|
||||
|
||||
PRINT_MODULE_USAGE_PARAM_COMMENT("WARNING: motors will ramp up to full speed!");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -341,7 +357,7 @@ int motor_ramp_thread_main(int argc, char *argv[])
|
||||
|
||||
switch (ramp_state) {
|
||||
case RAMP_INIT: {
|
||||
PX4_WARN("setting pwm min: %d", _min_pwm);
|
||||
PX4_INFO("setting pwm min: %d", _min_pwm);
|
||||
set_min_pwm(fd, max_channels, _min_pwm);
|
||||
ramp_state = RAMP_MIN;
|
||||
break;
|
||||
@ -349,7 +365,7 @@ int motor_ramp_thread_main(int argc, char *argv[])
|
||||
|
||||
case RAMP_MIN: {
|
||||
if (timer > 3.0f) {
|
||||
PX4_WARN("starting %s: %.2f sec", _mode_c, (double)_ramp_time);
|
||||
PX4_INFO("starting %s: %.2f sec", _mode_c, (double)_ramp_time);
|
||||
start = hrt_absolute_time();
|
||||
ramp_state = RAMP_RAMP;
|
||||
}
|
||||
@ -376,7 +392,7 @@ int motor_ramp_thread_main(int argc, char *argv[])
|
||||
output = _mode != RAMP ? output : 1.0f;
|
||||
start = hrt_absolute_time();
|
||||
ramp_state = RAMP_WAIT;
|
||||
PX4_WARN("%s finished, waiting", _mode_c);
|
||||
PX4_INFO("%s finished, waiting", _mode_c);
|
||||
}
|
||||
|
||||
set_out(fd, max_channels, output);
|
||||
@ -386,7 +402,7 @@ int motor_ramp_thread_main(int argc, char *argv[])
|
||||
case RAMP_WAIT: {
|
||||
if (timer > 0.5f) {
|
||||
_thread_should_exit = true;
|
||||
PX4_WARN("stopping");
|
||||
PX4_INFO("stopping");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user