mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
fixed erroneous task_spawn
This commit is contained in:
committed by
Daniel Agar
parent
198466306e
commit
531242468e
@@ -205,6 +205,8 @@ void UUVAttitudeControl::Run()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
perf_begin(_loop_perf);
|
||||||
|
|
||||||
/* check vehicle control mode for changes to publication state */
|
/* check vehicle control mode for changes to publication state */
|
||||||
_vcontrol_mode_sub.update(&_vcontrol_mode);
|
_vcontrol_mode_sub.update(&_vcontrol_mode);
|
||||||
|
|
||||||
@@ -240,8 +242,6 @@ void UUVAttitudeControl::Run()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
perf_end(_loop_perf);
|
|
||||||
|
|
||||||
/* Manual Control mode (e.g. gamepad,...) - raw feedthrough no assistance */
|
/* Manual Control mode (e.g. gamepad,...) - raw feedthrough no assistance */
|
||||||
if (_manual_control_setpoint_sub.update(&_manual_control_setpoint)) {
|
if (_manual_control_setpoint_sub.update(&_manual_control_setpoint)) {
|
||||||
// This should be copied even if not in manual mode. Otherwise, the poll(...) call will keep
|
// This should be copied even if not in manual mode. Otherwise, the poll(...) call will keep
|
||||||
@@ -264,42 +264,30 @@ void UUVAttitudeControl::Run()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
warnx("exiting.\n");
|
perf_end(_loop_perf);
|
||||||
}
|
}
|
||||||
|
|
||||||
int UUVAttitudeControl::task_spawn(int argc, char *argv[])
|
int UUVAttitudeControl::task_spawn(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
/* start the task */
|
|
||||||
_task_id = px4_task_spawn_cmd("uuv_att_ctrl",
|
|
||||||
SCHED_DEFAULT,
|
|
||||||
SCHED_PRIORITY_ATTITUDE_CONTROL,
|
|
||||||
1700, // maybe switch to 1500
|
|
||||||
(px4_main_t)&UUVAttitudeControl::run_trampoline,
|
|
||||||
nullptr);
|
|
||||||
|
|
||||||
if (_task_id < 0) {
|
|
||||||
warn("task start failed");
|
|
||||||
return -errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
UUVAttitudeControl *UUVAttitudeControl::instantiate(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
|
|
||||||
if (argc > 0) {
|
|
||||||
PX4_WARN("Command 'start' takes no arguments.");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
UUVAttitudeControl *instance = new UUVAttitudeControl();
|
UUVAttitudeControl *instance = new UUVAttitudeControl();
|
||||||
|
|
||||||
if (instance == nullptr) {
|
if (instance) {
|
||||||
PX4_ERR("Failed to instantiate UUVAttitudeControl object");
|
_object.store(instance);
|
||||||
|
_task_id = task_id_is_work_queue;
|
||||||
|
|
||||||
|
if (instance->init()) {
|
||||||
|
return PX4_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance;
|
} else {
|
||||||
|
PX4_ERR("alloc failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
delete instance;
|
||||||
|
_object.store(nullptr);
|
||||||
|
_task_id = -1;
|
||||||
|
|
||||||
|
return PX4_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
int UUVAttitudeControl::custom_command(int argc, char *argv[])
|
int UUVAttitudeControl::custom_command(int argc, char *argv[])
|
||||||
|
|||||||
@@ -95,9 +95,6 @@ public:
|
|||||||
/** @see ModuleBase */
|
/** @see ModuleBase */
|
||||||
static int task_spawn(int argc, char *argv[]);
|
static int task_spawn(int argc, char *argv[]);
|
||||||
|
|
||||||
/** @see ModuleBase */
|
|
||||||
static UUVAttitudeControl *instantiate(int argc, char *argv[]);
|
|
||||||
|
|
||||||
static int custom_command(int argc, char *argv[]);
|
static int custom_command(int argc, char *argv[]);
|
||||||
|
|
||||||
/** @see ModuleBase */
|
/** @see ModuleBase */
|
||||||
|
|||||||
Reference in New Issue
Block a user