mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 01:53:34 +08:00
Qurt qshell implementation (#20736)
This commit is contained in:
@@ -57,6 +57,8 @@ muorb_main(int argc, char *argv[])
|
||||
// Register the protobuf channel with UORB.
|
||||
uORB::AppsProtobufChannel *channel = uORB::AppsProtobufChannel::GetInstance();
|
||||
|
||||
PX4_INFO("Got muorb start command");
|
||||
|
||||
if (channel && channel->Initialize(enable_debug)) {
|
||||
uORB::Manager::get_instance()->set_uorb_communicator(channel);
|
||||
return OK;
|
||||
@@ -65,7 +67,13 @@ muorb_main(int argc, char *argv[])
|
||||
} else if (!strcmp(argv[1], "test")) {
|
||||
uORB::AppsProtobufChannel *channel = uORB::AppsProtobufChannel::GetInstance();
|
||||
|
||||
if (channel && channel->Initialize(enable_debug) && channel->Test()) { return OK; }
|
||||
PX4_INFO("Got muorb test command");
|
||||
|
||||
if (channel && channel->Initialize(enable_debug)) {
|
||||
uORB::Manager::get_instance()->set_uorb_communicator(channel);
|
||||
|
||||
if (channel->Test()) { return OK; }
|
||||
}
|
||||
|
||||
} else if (!strcmp(argv[1], "stop")) {
|
||||
if (uORB::AppsProtobufChannel::isInstance() == false) {
|
||||
|
||||
@@ -219,16 +219,21 @@ bool uORB::AppsProtobufChannel::Test()
|
||||
|
||||
bool uORB::AppsProtobufChannel::Initialize(bool enable_debug)
|
||||
{
|
||||
fc_callbacks cb = {&ReceiveCallback, &AdvertiseCallback,
|
||||
&SubscribeCallback, &UnsubscribeCallback
|
||||
};
|
||||
if (! _Initialized) {
|
||||
fc_callbacks cb = { &ReceiveCallback, &AdvertiseCallback,
|
||||
&SubscribeCallback, &UnsubscribeCallback
|
||||
};
|
||||
|
||||
if (fc_sensor_initialize(enable_debug, &cb) != 0) {
|
||||
if (enable_debug) { PX4_INFO("Warning: muorb protobuf initalize method failed"); }
|
||||
if (fc_sensor_initialize(enable_debug, &cb) != 0) {
|
||||
if (enable_debug) { PX4_INFO("Warning: muorb protobuf initalize method failed"); }
|
||||
|
||||
} else {
|
||||
PX4_INFO("muorb protobuf initalize method succeeded");
|
||||
_Initialized = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
PX4_INFO("muorb protobuf initalize method succeeded");
|
||||
_Initialized = true;
|
||||
PX4_INFO("AppsProtobufChannel already initialized");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -192,6 +192,10 @@ static void *test_runner(void *)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern int slpi_main(int argc, char *argv[]);
|
||||
__END_DECLS
|
||||
|
||||
int px4muorb_orb_initialize(fc_func_ptrs *func_ptrs, int32_t clock_offset_us)
|
||||
{
|
||||
hrt_set_absolute_time_offset(clock_offset_us);
|
||||
@@ -226,6 +230,16 @@ int px4muorb_orb_initialize(fc_func_ptrs *func_ptrs, int32_t clock_offset_us)
|
||||
uORB::Manager::get_instance()->set_uorb_communicator(
|
||||
uORB::ProtobufChannel::GetInstance());
|
||||
|
||||
const char *argv[3] = { "slpi", "start" };
|
||||
int argc = 2;
|
||||
|
||||
// Make sure that argv has a NULL pointer in the end.
|
||||
argv[argc] = NULL;
|
||||
|
||||
if (slpi_main(argc, (char **) argv)) {
|
||||
PX4_ERR("slpi failed in %s", __FUNCTION__);
|
||||
}
|
||||
|
||||
px4muorb_orb_initialized = true;
|
||||
|
||||
if (_px4_muorb_debug) { PX4_INFO("px4muorb_orb_initialize called"); }
|
||||
|
||||
Reference in New Issue
Block a user