本文整理汇总了C++中px4_task_spawn_cmd函数的典型用法代码示例。如果您正苦于以下问题:C++ px4_task_spawn_cmd函数的具体用法?C++ px4_task_spawn_cmd怎么用?C++ px4_task_spawn_cmd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了px4_task_spawn_cmd函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: work_queues_init
/****************************************************************************
* Public Functions
****************************************************************************/
void work_queues_init(void)
{
sem_init(&_work_lock[HPWORK], 0, 1);
sem_init(&_work_lock[LPWORK], 0, 1);
#ifdef CONFIG_SCHED_USRWORK
sem_init(&_work_lock[USRWORK], 0, 1);
#endif
// Create high priority worker thread
g_work[HPWORK].pid = px4_task_spawn_cmd("wkr_high",
SCHED_DEFAULT,
SCHED_PRIORITY_MAX - 1,
2000,
work_hpthread,
(char *const *)NULL);
// Create low priority worker thread
g_work[LPWORK].pid = px4_task_spawn_cmd("wkr_low",
SCHED_DEFAULT,
SCHED_PRIORITY_MIN,
2000,
work_lpthread,
(char *const *)NULL);
}
开发者ID:JW-CHOI,项目名称:Firmware,代码行数:28,代码来源:work_thread.c
示例2: test_dataman
int test_dataman(int argc, char *argv[])
{
int i, num_tasks = 4;
char buffer[DM_MAX_DATA_SIZE];
if (argc > 1) {
num_tasks = atoi(argv[1]);
}
sems = (px4_sem_t *)malloc(num_tasks * sizeof(px4_sem_t));
warnx("Running %d tasks", num_tasks);
for (i = 0; i < num_tasks; i++) {
int task;
char a[16];
sprintf(a, "%d", i);
const char *av[2];
av[0] = a;
av[1] = 0;
px4_sem_init(sems + i, 1, 0);
/* sems use case is a signal */
px4_sem_setprotocol(&sems, SEM_PRIO_NONE);
/* start the task */
if ((task = px4_task_spawn_cmd("dataman", SCHED_DEFAULT, SCHED_PRIORITY_MAX - 5, 2048, task_main, (void *)av)) <= 0) {
warn("task start failed");
}
}
for (i = 0; i < num_tasks; i++) {
px4_sem_wait(sems + i);
px4_sem_destroy(sems + i);
}
free(sems);
dm_restart(DM_INIT_REASON_IN_FLIGHT);
for (i = 0; i < NUM_MISSIONS_SUPPORTED; i++) {
if (dm_read(DM_KEY_WAYPOINTS_OFFBOARD_1, i, buffer, sizeof(buffer)) != 0) {
break;
}
}
if (i >= NUM_MISSIONS_SUPPORTED) {
warnx("Restart in-flight failed");
return -1;
}
dm_restart(DM_INIT_REASON_POWER_ON);
for (i = 0; i < NUM_MISSIONS_SUPPORTED; i++) {
if (dm_read(DM_KEY_WAYPOINTS_OFFBOARD_1, i, buffer, sizeof(buffer)) != 0) {
warnx("Restart power-on failed");
return -1;
}
}
return 0;
}
开发者ID:dammstanger,项目名称:Firmware,代码行数:60,代码来源:test_dataman.c
示例3: ASSERT
int Ekf2::start()
{
ASSERT(_control_task == -1);
#ifdef __PX4_QURT
// On the DSP we seem to get random crashes with a stack size below 13000.
const unsigned stack_size = 15000;
#else
const unsigned stack_size = 9000;
#endif
/* start the task */
_control_task = px4_task_spawn_cmd("ekf2",
SCHED_DEFAULT,
SCHED_PRIORITY_MAX - 5,
stack_size,
(px4_main_t)&Ekf2::task_main_trampoline,
nullptr);
if (_control_task < 0) {
PX4_WARN("task start failed");
return -errno;
}
return OK;
}
开发者ID:PulkitRustagi,项目名称:Firmware,代码行数:27,代码来源:ekf2_main.cpp
示例4: test_note
int uORBTest::UnitTest::test_multi2()
{
test_note("Testing multi-topic 2 test (queue simulation)");
//test: first subscribe, then advertise
_thread_should_exit = false;
const int num_instances = 3;
int orb_data_fd[num_instances];
int orb_data_next = 0;
for (int i = 0; i < num_instances; ++i) {
// PX4_WARN("subscribe %i, t=%" PRIu64, i, hrt_absolute_time());
orb_data_fd[i] = orb_subscribe_multi(ORB_ID(orb_test_medium_multi), i);
}
char *const args[1] = { NULL };
int pubsub_task = px4_task_spawn_cmd("uorb_test_multi",
SCHED_DEFAULT,
SCHED_PRIORITY_MAX - 5,
1500,
(px4_main_t)&uORBTest::UnitTest::pub_test_multi2_entry,
args);
if (pubsub_task < 0) {
return test_fail("failed launching task");
}
hrt_abstime last_time = 0;
while (!_thread_should_exit) {
bool updated = false;
int orb_data_cur_fd = orb_data_fd[orb_data_next];
orb_check(orb_data_cur_fd, &updated);
if (updated) {
struct orb_test_medium msg;
orb_copy(ORB_ID(orb_test_medium_multi), orb_data_cur_fd, &msg);
usleep(1000);
if (last_time >= msg.time && last_time != 0) {
return test_fail("Timestamp not increasing! (%" PRIu64 " >= %" PRIu64 ")", last_time, msg.time);
}
last_time = msg.time;
// PX4_WARN(" got message (val=%i, idx=%i, t=%" PRIu64 ")", msg.val, orb_data_next, msg.time);
orb_data_next = (orb_data_next + 1) % num_instances;
}
}
for (int i = 0; i < num_instances; ++i) {
orb_unsubscribe(orb_data_fd[i]);
}
return test_note("PASS multi-topic 2 test (queue simulation)");
}
开发者ID:PulkitRustagi,项目名称:Firmware,代码行数:58,代码来源:uORBTest_UnitTest.cpp
示例5: micrortps_client_main
int micrortps_client_main(int argc, char *argv[])
{
if (argc < 2) {
usage(argv[0]);
return -1;
}
if (!strcmp(argv[1], "start")) {
if (_rtps_task != -1) {
PX4_INFO("Already running");
return -1;
}
_rtps_task = px4_task_spawn_cmd("rtps",
SCHED_DEFAULT,
SCHED_PRIORITY_DEFAULT,
4096,
(px4_main_t) micrortps_start,
(char *const *)argv);
if (_rtps_task < 0) {
PX4_WARN("Could not start task");
_rtps_task = -1;
return -1;
}
return 0;
}
if (!strcmp(argv[1], "status")) {
if (_rtps_task == -1) {
PX4_INFO("Not running");
} else {
PX4_INFO("Running");
}
return 0;
}
if (!strcmp(argv[1], "stop")) {
if (_rtps_task == -1) {
PX4_INFO("Not running");
return -1;
}
_should_exit_task = true;
if (nullptr != transport_node) { transport_node->close(); }
return 0;
}
usage(argv[0]);
return -1;
}
开发者ID:SJW623,项目名称:Firmware,代码行数:57,代码来源:microRTPS_client_main.cpp
示例6: position_estimator_inav_main
/**
* The position_estimator_inav_thread only briefly exists to start
* the background job. The stack size assigned in the
* Makefile does only apply to this management task.
*
* The actual stack size should be set in the call
* to task_create().
*/
int position_estimator_inav_main(int argc, char *argv[])
{
if (argc < 2) {
usage("missing command");
}
if (!strcmp(argv[1], "start")) {
if (thread_running) {
warnx("already running");
/* this is not an error */
return 0;
}
inav_verbose_mode = false;
if ((argc > 2) && (!strcmp(argv[2], "-v"))) {
inav_verbose_mode = true;
}
thread_should_exit = false;
position_estimator_inav_task = px4_task_spawn_cmd("position_estimator_inav",
SCHED_DEFAULT, SCHED_PRIORITY_MAX - 5, 5000,
position_estimator_inav_thread_main,
(argv && argc > 2) ? (char * const *) &argv[2] : (char * const *) NULL);
return 0;
}
if (!strcmp(argv[1], "stop")) {
if (thread_running) {
warnx("stop");
thread_should_exit = true;
} else {
warnx("not started");
}
return 0;
}
if (!strcmp(argv[1], "status")) {
if (thread_running) {
warnx("is running");
} else {
warnx("not started");
}
return 0;
}
usage("unrecognized command");
return 1;
}
开发者ID:Nitaym,项目名称:Firmware,代码行数:61,代码来源:position_estimator_inav_main.c
示例7: start
int start()
{
if (_is_running) {
PX4_WARN("bebop_flow already running");
return -1;
}
// Prepare the I2C device
image_sensor = new MT9V117(IMAGE_DEVICE_PATH);
if (image_sensor == nullptr) {
PX4_ERR("failed instantiating image sensor object");
return -1;
}
int ret = image_sensor->start();
if (ret != 0) {
PX4_ERR("Image sensor start failed");
return ret;
}
// Start the video device
g_dev = new VideoDevice(dev_name, 6);
if (g_dev == nullptr) {
PX4_ERR("failed instantiating video device object");
return -1;
}
ret = g_dev->start();
if (ret != 0) {
PX4_ERR("Video device start failed");
return ret;
}
/* start the task */
_task_handle = px4_task_spawn_cmd("bebop_flow",
SCHED_DEFAULT,
SCHED_PRIORITY_DEFAULT,
2000,
(px4_main_t)&task_main,
nullptr);
if (_task_handle < 0) {
PX4_WARN("task start failed");
return -1;
}
return 0;
}
开发者ID:AlexisTM,项目名称:Firmware,代码行数:52,代码来源:bebop_flow.cpp
示例8: landing_target_estimator_main
/**
* Main entry point for this module
**/
int landing_target_estimator_main(int argc, char *argv[])
{
if (argc < 2) {
goto exiterr;
}
if (argc >= 2 && !strcmp(argv[1], "start")) {
if (thread_running) {
PX4_INFO("already running");
/* this is not an error */
return 0;
}
thread_should_exit = false;
daemon_task = px4_task_spawn_cmd("landing_target_estimator",
SCHED_DEFAULT,
SCHED_PRIORITY_DEFAULT,
2000,
landing_target_estimator_thread_main,
(argv) ? (char *const *)&argv[2] : nullptr);
return 0;
}
if (!strcmp(argv[1], "stop")) {
thread_should_exit = true;
if (!thread_running) {
PX4_WARN("landing_target_estimator not running");
}
return 0;
}
if (!strcmp(argv[1], "status")) {
if (thread_running) {
PX4_INFO("running");
} else {
PX4_INFO("not started");
}
return 0;
}
exiterr:
PX4_WARN("usage: landing_target_estimator {start|stop|status}");
return 1;
}
开发者ID:AlexisTM,项目名称:Firmware,代码行数:52,代码来源:landing_target_estimator_main.cpp
示例9: px4_task_spawn_cmd
int
Syslink::start()
{
_task_running = true;
_syslink_task = px4_task_spawn_cmd(
"syslink",
SCHED_DEFAULT,
SCHED_PRIORITY_DEFAULT,
1500,
Syslink::task_main_trampoline,
NULL
);
return 0;
}
开发者ID:airmind,项目名称:OpenMindPX,代码行数:15,代码来源:syslink_main.cpp
示例10: PX4_INFO
int IridiumSBD::start(int argc, char *argv[])
{
PX4_INFO("starting");
if (IridiumSBD::instance != nullptr) {
PX4_WARN("already started");
return PX4_ERROR;
}
IridiumSBD::instance = new IridiumSBD();
IridiumSBD::task_handle = px4_task_spawn_cmd("iridiumsbd", SCHED_DEFAULT,
SCHED_PRIORITY_SLOW_DRIVER, 1300, (main_t)&IridiumSBD::main_loop_helper, argv);
return OK;
}
开发者ID:elikos,项目名称:Firmware,代码行数:16,代码来源:IridiumSBD.cpp
示例11: attitude_estimator_ekf_main
/**
* The attitude_estimator_ekf app only briefly exists to start
* the background job. The stack size assigned in the
* Makefile does only apply to this management task.
*
* The actual stack size should be set in the call
* to px4_task_spawn_cmd().
*/
int attitude_estimator_ekf_main(int argc, char *argv[])
{
if (argc < 2) {
usage("missing command");
return 1;
}
if (!strcmp(argv[1], "start")) {
if (thread_running) {
warnx("already running\n");
/* this is not an error */
return 0;
}
thread_should_exit = false;
attitude_estimator_ekf_task = px4_task_spawn_cmd("attitude_estimator_ekf",
SCHED_DEFAULT,
SCHED_PRIORITY_MAX - 5,
7700,
attitude_estimator_ekf_thread_main,
(argv) ? (char * const *)&argv[2] : (char * const *)NULL);
return 0;
}
if (!strcmp(argv[1], "stop")) {
thread_should_exit = true;
return 0;
}
if (!strcmp(argv[1], "status")) {
if (thread_running) {
warnx("running");
return 0;
} else {
warnx("not started");
return 1;
}
return 0;
}
usage("unrecognized command");
return 1;
}
开发者ID:AERO-Project,项目名称:Firmware,代码行数:54,代码来源:attitude_estimator_ekf_main.cpp
示例12: hello_main
int hello_main(int argc, char *argv[])
{
if (argc < 2) {
PX4_WARN("usage: hello {start|stop|status}\n");
return 1;
}
if (!strcmp(argv[1], "start")) {
if (HelloExample::appState.isRunning()) {
PX4_INFO("already running\n");
/* this is not an error */
return 0;
}
daemon_task = px4_task_spawn_cmd("hello",
SCHED_DEFAULT,
SCHED_PRIORITY_MAX - 5,
2000,
PX4_MAIN,
(argv) ? (char *const *)&argv[2] : (char *const *)nullptr);
return 0;
}
if (!strcmp(argv[1], "stop")) {
HelloExample::appState.requestExit();
return 0;
}
if (!strcmp(argv[1], "status")) {
if (HelloExample::appState.isRunning()) {
PX4_INFO("is running\n");
} else {
PX4_INFO("not started\n");
}
return 0;
}
PX4_WARN("usage: hello_main {start|stop|status}\n");
return 1;
}
开发者ID:AlexisTM,项目名称:Firmware,代码行数:45,代码来源:hello_start.cpp
示例13: wqueue_test_main
int wqueue_test_main(int argc, char *argv[])
{
if (argc < 2) {
PX4_INFO("usage: wqueue_test {start|stop|status}\n");
return 1;
}
if (!strcmp(argv[1], "start")) {
if (WQueueTest::appState.isRunning()) {
PX4_INFO("already running\n");
/* this is not an error */
return 0;
}
daemon_task = px4_task_spawn_cmd("wqueue",
SCHED_DEFAULT,
SCHED_PRIORITY_MAX - 5,
2000,
PX4_MAIN,
(argv) ? (char *const *)&argv[2] : (char *const *)NULL);
return 0;
}
if (!strcmp(argv[1], "stop")) {
WQueueTest::appState.requestExit();
return 0;
}
if (!strcmp(argv[1], "status")) {
if (WQueueTest::appState.isRunning()) {
PX4_INFO("is running\n");
} else {
PX4_INFO("not started\n");
}
return 0;
}
PX4_INFO("usage: wqueue_test {start|stop|status}\n");
return 1;
}
开发者ID:1002victor,项目名称:Firmware,代码行数:45,代码来源:wqueue_start_posix.cpp
示例14: px4_task_spawn_cmd
int GPS::init()
{
char gps_num[2] = {(char)('0' + _gps_num), 0};
char *const args[2] = { gps_num, NULL };
/* start the GPS driver worker task */
_task = px4_task_spawn_cmd("gps", SCHED_DEFAULT,
SCHED_PRIORITY_SLOW_DRIVER, 1400, (px4_main_t)&GPS::task_main_trampoline, args);
if (_task < 0) {
PX4_WARN("task start failed: %d", errno);
_task = -1;
return -errno;
}
return OK;
}
开发者ID:dammstanger,项目名称:Firmware,代码行数:18,代码来源:gps.cpp
示例15: rover_steering_control_main
/**
* The daemon app only briefly exists to start
* the background job. The stack size assigned in the
* Makefile does only apply to this management task.
*
* The actual stack size should be set in the call
* to px4_task_spawn_cmd().
*/
int rover_steering_control_main(int argc, char *argv[])
{
if (argc < 2) {
usage("missing command");
}
if (!strcmp(argv[1], "start")) {
if (thread_running) {
warnx("running");
/* this is not an error */
exit(0);
}
thread_should_exit = false;
deamon_task = px4_task_spawn_cmd("rover_steering_control",
SCHED_DEFAULT,
SCHED_PRIORITY_MAX - 20,
2048,
rover_steering_control_thread_main,
(argv) ? (char * const *)&argv[2] : (char * const *)NULL);
thread_running = true;
exit(0);
}
if (!strcmp(argv[1], "stop")) {
thread_should_exit = true;
exit(0);
}
if (!strcmp(argv[1], "status")) {
if (thread_running) {
warnx("running");
} else {
warnx("not started");
}
exit(0);
}
usage("unrecognized command");
exit(1);
}
开发者ID:Bjarne-Madsen,项目名称:Firmware,代码行数:52,代码来源:main.cpp
示例16: muorb_test_main
int muorb_test_main(int argc, char *argv[])
{
if (argc < 2) {
usage();
return 1;
}
if (!strcmp(argv[1], "start")) {
if (MuorbTestExample::appState.isRunning()) {
PX4_DEBUG("already running");
/* this is not an error */
return 0;
}
daemon_task = px4_task_spawn_cmd("muorb_test",
SCHED_DEFAULT,
SCHED_PRIORITY_MAX - 5,
16000,
PX4_MAIN,
(char* const*)argv);
return 0;
}
if (!strcmp(argv[1], "stop")) {
MuorbTestExample::appState.requestExit();
return 0;
}
if (!strcmp(argv[1], "status")) {
if (MuorbTestExample::appState.isRunning()) {
PX4_DEBUG("is running");
} else {
PX4_DEBUG("not started");
}
return 0;
}
usage();
return 1;
}
开发者ID:Bjarne-Madsen,项目名称:Firmware,代码行数:44,代码来源:muorb_test_start_posix.cpp
示例17: ex_fixedwing_control_main
/**
* The daemon app only briefly exists to start
* the background job. The stack size assigned in the
* Makefile does only apply to this management task.
*
* The actual stack size should be set in the call
* to px4_task_spawn_cmd().
*/
int ex_fixedwing_control_main(int argc, char *argv[])
{
if (argc < 2) {
usage("missing command");
}
if (!strcmp(argv[1], "start")) {
if (thread_running) {
printf("ex_fixedwing_control already running\n");
/* this is not an error */
exit(0);
}
thread_should_exit = false;
deamon_task = px4_task_spawn_cmd("ex_fixedwing_control",
SCHED_DEFAULT,
SCHED_PRIORITY_MAX - 20,
2048,
fixedwing_control_thread_main,
(argv) ? (char *const *)&argv[2] : (char *const *)nullptr);
thread_running = true;
exit(0);
}
if (!strcmp(argv[1], "stop")) {
thread_should_exit = true;
exit(0);
}
if (!strcmp(argv[1], "status")) {
if (thread_running) {
printf("\tex_fixedwing_control is running\n");
} else {
printf("\tex_fixedwing_control not started\n");
}
exit(0);
}
usage("unrecognized command");
exit(1);
}
开发者ID:ayu135,项目名称:Firmware,代码行数:52,代码来源:main.cpp
示例18: px4_daemon_app_main
/**
* The daemon app only briefly exists to start
* the background job. The stack size assigned in the
* Makefile does only apply to this management task.
*
* The actual stack size should be set in the call
* to task_create().
*/
int px4_daemon_app_main(int argc, char *argv[])
{
if (argc < 2) {
usage("missing command");
return 1;
}
if (!strcmp(argv[1], "start")) {
if (thread_running) {
warnx("daemon already running\n");
/* this is not an error */
return 0;
}
thread_should_exit = false;
daemon_task = px4_task_spawn_cmd("daemon",
SCHED_DEFAULT,
SCHED_PRIORITY_DEFAULT,
2000,
px4_daemon_thread_main,
(argv) ? (char *const *)&argv[2] : (char *const *)NULL);
return 0;
}
if (!strcmp(argv[1], "stop")) {
thread_should_exit = true;
return 0;
}
if (!strcmp(argv[1], "status")) {
if (thread_running) {
warnx("\trunning\n");
} else {
warnx("\tnot started\n");
}
return 0;
}
usage("unrecognized command");
return 1;
}
开发者ID:AlexanderAurora,项目名称:Firmware,代码行数:52,代码来源:px4_daemon_app.c
示例19: ASSERT
int AttitudePositionEstimatorEKF::start()
{
ASSERT(_estimator_task == -1);
/* start the task */
_estimator_task = px4_task_spawn_cmd("ekf_att_pos_estimator",
SCHED_DEFAULT,
SCHED_PRIORITY_MAX - 40,
7500,
(px4_main_t)&AttitudePositionEstimatorEKF::task_main_trampoline,
nullptr);
if (_estimator_task < 0) {
warn("task start failed");
return -errno;
}
return OK;
}
开发者ID:Dormanfcbm,项目名称:Firmware,代码行数:19,代码来源:ekf_att_pos_estimator_main.cpp
示例20: start
void start()
{
ASSERT(_task_handle == -1);
/* start the task */
_task_handle = px4_task_spawn_cmd("mpu9x50_main",
SCHED_DEFAULT,
SCHED_PRIORITY_MAX,
1500,
(px4_main_t)&task_main_trampoline,
nullptr);
if (_task_handle < 0) {
warn("mpu9x50_main task start failed");
return;
}
_is_running = true;
}
开发者ID:2013-8-15,项目名称:Firmware,代码行数:19,代码来源:mpu9x50_main.cpp
注:本文中的px4_task_spawn_cmd函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论