mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-29 01:34:08 +08:00
add start wrapper for mc att ctl multip
This commit is contained in:
parent
5cb208c32f
commit
092a3c5129
@ -55,72 +55,8 @@
|
||||
#include "mc_att_control.h"
|
||||
|
||||
bool thread_running = false; /**< Deamon status flag */
|
||||
static int daemon_task; /**< Handle of deamon task / thread */
|
||||
namespace px4
|
||||
{
|
||||
bool task_should_exit = false;
|
||||
}
|
||||
|
||||
using namespace px4;
|
||||
|
||||
PX4_MAIN_FUNCTION(mc_att_control_m);
|
||||
|
||||
#if !defined(__PX4_ROS)
|
||||
/**
|
||||
* Multicopter attitude control app start / stop handling function
|
||||
*
|
||||
* @ingroup apps
|
||||
*/
|
||||
|
||||
extern "C" __EXPORT int mc_att_control_m_main(int argc, char *argv[]);
|
||||
int mc_att_control_m_main(int argc, char *argv[])
|
||||
{
|
||||
if (argc < 1) {
|
||||
errx(1, "usage: mc_att_control_m {start|stop|status}");
|
||||
}
|
||||
|
||||
if (!strcmp(argv[1], "start")) {
|
||||
|
||||
if (thread_running) {
|
||||
warnx("already running");
|
||||
/* this is not an error */
|
||||
exit(0);
|
||||
}
|
||||
|
||||
task_should_exit = false;
|
||||
|
||||
daemon_task = task_spawn_cmd("mc_att_control_m",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 5,
|
||||
3000,
|
||||
mc_att_control_m_task_main,
|
||||
(argv) ? (char * const *)&argv[2] : (char * const *)NULL);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (!strcmp(argv[1], "stop")) {
|
||||
task_should_exit = true;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (!strcmp(argv[1], "status")) {
|
||||
if (thread_running) {
|
||||
warnx("is running");
|
||||
|
||||
} else {
|
||||
warnx("not started");
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
warnx("unrecognized command");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
PX4_MAIN_FUNCTION(mc_att_control_m)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
px4::init(argc, argv, "mc_att_control_m");
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
MODULE_COMMAND = mc_att_control_m
|
||||
|
||||
SRCS = mc_att_control_main.cpp \
|
||||
mc_att_control_start_nuttx.cpp \
|
||||
mc_att_control.cpp \
|
||||
mc_att_control_base.cpp \
|
||||
mc_att_control_params.c
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user