Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,74 @@
|
||||
MACRO(_BUILD_TEST test_id)
|
||||
add_executable(TabUASTest${test_id} test${test_id}.cpp)
|
||||
FIND_PACKAGE(TMSIF REQUIRED)
|
||||
|
||||
|
||||
|
||||
target_compile_definitions(TabUASTest${test_id} PUBLIC DDS_VENDOR_CYCLONE)
|
||||
|
||||
|
||||
target_link_libraries(TabUASTest${test_id} PRIVATE
|
||||
TMSIF::tmsif-cyclone
|
||||
TMSIF::ddscxx
|
||||
TMSIF::ddkit-cyclone
|
||||
)
|
||||
ENDMACRO()
|
||||
|
||||
|
||||
#_BUILD_TEST(1)
|
||||
#_BUILD_TEST(2)
|
||||
_BUILD_TEST(3)
|
||||
|
||||
|
||||
# # test4
|
||||
# add_executable(TabUASTest4 test4.cpp)
|
||||
# target_link_libraries(TabUASTest4
|
||||
# PRIVATE
|
||||
# TmsIfAdapter
|
||||
# tabPluginInterface
|
||||
# )
|
||||
|
||||
|
||||
# # test4.1
|
||||
# add_executable(TabUASTest4_1 test4.cpp)
|
||||
# target_link_libraries(TabUASTest4_1
|
||||
# PRIVATE
|
||||
# TmsIfAdapter
|
||||
# # /opt/RTI/lib/x64Linux4gcc7.3.0/libnddsc.so
|
||||
# # /opt/RTI/lib/x64Linux4gcc7.3.0/libnddscore.so
|
||||
# # /opt/RTI/lib/x64Linux4gcc7.3.0/libnddscpp2.so
|
||||
# )
|
||||
# #target_include_directories(TabUASTest${test_id} PRIVATE
|
||||
# #
|
||||
# #)
|
||||
|
||||
|
||||
# test4_2
|
||||
add_executable(TabUASTest4_2 test4_2.cpp)
|
||||
target_link_libraries(TabUASTest4_2
|
||||
PRIVATE
|
||||
#TmsIfAdapter via dlopen !
|
||||
TmsIfAdapterInterface
|
||||
tabPluginInterface
|
||||
)
|
||||
|
||||
|
||||
# # test5
|
||||
# add_executable(TabUASTest5 test5.cpp)
|
||||
# target_link_libraries(TabUASTest5
|
||||
# PRIVATE
|
||||
# tabPluginInterface
|
||||
# )
|
||||
|
||||
|
||||
|
||||
# test6
|
||||
add_executable(TabUASTest6 test6.cpp)
|
||||
target_link_libraries(TabUASTest6
|
||||
PRIVATE
|
||||
Qt5::Core
|
||||
Qt5::Widgets
|
||||
|
||||
#TmsIfAdapter via dlopen !
|
||||
TmsIfAdapterInterface
|
||||
)
|
||||
+163
@@ -0,0 +1,163 @@
|
||||
// std
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
// tmsif
|
||||
#include <tmsif/api/MissionCtrl.hpp>
|
||||
|
||||
// ddkit
|
||||
#include <ddkit/actors/Session.hpp>
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
std::cout << "App started ..." << std::endl;
|
||||
|
||||
const int domain = 4; // TMS-IF MAVLink Adapter runs on domain 4
|
||||
ddkit::actors::Session session(domain);
|
||||
|
||||
// starting Service
|
||||
const std::string serviceName = "UAV_MissionCtrl1";
|
||||
|
||||
auto client = M_MissionCtrl::Client::createWriteOnly(session, serviceName);
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
|
||||
client->CmdPerformAction(M_MissionCtrl::CommandedActionType(M_MissionCtrl::TaskType({M_MissionCtrl::TaskCategoryKind::Type::Arm}, {}, {}, {}), {}));
|
||||
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
|
||||
client->CmdPerformAction(M_MissionCtrl::CommandedActionType(M_MissionCtrl::TaskType({M_MissionCtrl::TaskCategoryKind::Type::Arm}, {}, {}, {}), {}));
|
||||
|
||||
|
||||
while(true) // keep app running
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// // std
|
||||
// #include <iostream>
|
||||
// #include <chrono>
|
||||
// #include <thread>
|
||||
|
||||
// // tmsif
|
||||
// #include <tmsif/api/MissionCtrl.hpp>
|
||||
|
||||
// // ddkit
|
||||
// #include <ddkit/actors/Session.hpp>
|
||||
|
||||
|
||||
// // class DeviceClient : public M_MissionCtrl::IClient
|
||||
// // {
|
||||
// // public:
|
||||
// // void ReportDeviceStatus(M_MissionCtrl::DeviceStatusType const& Status, bool IsRemoved) override
|
||||
// // {
|
||||
// // fprintf(stdout, "ReportDeviceStatus: Status.OperationStatus.Mode set? %d\n", !(int)Status.OperationStatus.Mode.empty());
|
||||
// // }
|
||||
// // };
|
||||
|
||||
|
||||
// int main(int argc, char *argv[])
|
||||
// {
|
||||
// std::cout << "App started ..." << std::endl;
|
||||
|
||||
// const int domain = 4; // TMS-IF MAVLink Adapter runs on domain 4
|
||||
// ddkit::actors::Session session(domain);
|
||||
|
||||
// // starting Service
|
||||
// const std::string serviceName = "UAV_Device1";
|
||||
|
||||
// M_MissionCtrl::IService callbacksFromClients;
|
||||
// auto service = M_MissionCtrl::Service::create(session, serviceName, callbacksFromClients);
|
||||
|
||||
// // messages
|
||||
// // auto msg = M_MissionCtrl::AlarmLogType(M_Alert::AlarmStatusKind::Active, false, false,
|
||||
// // false, {}, M_Alert::AlarmCategoryKind::Type::Warning, M_Common::TimeType(4000, 0), {});
|
||||
|
||||
// uint64_t i = 1;
|
||||
// while(true)
|
||||
// {
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
|
||||
// // send data cyclic for example
|
||||
// service. // ReportAlarmLog("test123", msg, false);
|
||||
// }
|
||||
|
||||
// return 0;
|
||||
// }
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
// std
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
// tmsif
|
||||
#include <tmsif/api/Alert.hpp>
|
||||
|
||||
// ddkit
|
||||
#include <ddkit/actors/Session.hpp>
|
||||
|
||||
|
||||
// callback-implementations - messages from clients
|
||||
class AlertService : public M_Alert::IService
|
||||
{
|
||||
public:
|
||||
void CmdRaiseAlarm(M_Alert::AlarmConditionInfoType const& Condition) override
|
||||
{
|
||||
fprintf(stderr, "CmdRaiseAlarm !!\n");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class AlertClient : public M_Alert::IClient
|
||||
{
|
||||
public:
|
||||
|
||||
void setAlertClient(M_Alert::Client *uglyPointer)
|
||||
{m_client = uglyPointer;}
|
||||
|
||||
M_Alert::Client *m_client;
|
||||
|
||||
void ReportAlarmLog(M_Alert::AlertIdType const& KeyAlarmId, M_Alert::AlarmLogType const& Alarm, bool IsRemoved)
|
||||
{
|
||||
fprintf(stderr, "ReportAlarmLog !!\n");
|
||||
(*m_client)->CmdRaiseAlarm(M_Alert::AlarmConditionInfoType("a", "b", "c", "d", "e"));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
std::cout << "App started ..." << std::endl;
|
||||
|
||||
int domain = 5;
|
||||
ddkit::actors::Session session(domain);
|
||||
|
||||
// constructing callbacks
|
||||
AlertService callbacksFromClients;
|
||||
|
||||
// starting Service
|
||||
const std::string serviceName = "AlertService123";
|
||||
auto service = M_Alert::Service::create(session, serviceName, callbacksFromClients);
|
||||
|
||||
// client
|
||||
AlertClient callbacksFromServices;
|
||||
auto client = M_Alert::Client::create(session, serviceName, callbacksFromServices);
|
||||
callbacksFromServices.setAlertClient(&client);
|
||||
|
||||
// messages
|
||||
auto msg = M_Alert::AlarmLogType(M_Alert::AlarmStatusKind::Active, false, false,
|
||||
false, {}, M_Alert::AlarmCategoryKind::Type::Warning, M_Common::TimeType(4000, 0), {});
|
||||
|
||||
uint64_t i = 1;
|
||||
while(true) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
|
||||
// send data cyclic for example
|
||||
service->ReportAlarmLog("test123", msg, false);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
// std
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
// tmsif
|
||||
#include <tmsif/api/CoordinateFrame.hpp>
|
||||
|
||||
// ddkit
|
||||
#include <ddkit/actors/Session.hpp>
|
||||
|
||||
|
||||
class CoordinateFrameClient : public M_CoordinateFrame::IClient
|
||||
{
|
||||
public:
|
||||
void ReportPositions(std::string const& KeyId, M_Common::PositionListType const& PositionList, bool IsRemoved) override
|
||||
{
|
||||
fprintf(stdout, "ReportPositions: !!!\n");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
std::cout << "App started ..." << std::endl;
|
||||
|
||||
const int domain = 4; // TMS-IF MAVLink Adapter runs on domain 4
|
||||
// ddkit::actors::Session session(domain);
|
||||
|
||||
// starting Service
|
||||
const std::string serviceName = "UAV_Device1";
|
||||
|
||||
// client
|
||||
CoordinateFrameClient callbacksFromServices;
|
||||
auto client = M_CoordinateFrame::Client::create(domain, serviceName, callbacksFromServices);
|
||||
|
||||
fprintf(stderr, "now waiting");
|
||||
while(true) // keep app running
|
||||
{
|
||||
fprintf(stderr, ".");
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// // std
|
||||
// #include <iostream>
|
||||
// #include <chrono>
|
||||
// #include <thread>
|
||||
|
||||
// // tmsif
|
||||
// #include <tmsif/api/Device.hpp>
|
||||
|
||||
// // ddkit
|
||||
// #include <ddkit/actors/Session.hpp>
|
||||
|
||||
|
||||
// class DeviceClient : public M_Device::IClient
|
||||
// {
|
||||
// public:
|
||||
// void ReportDeviceStatus(M_Device::DeviceStatusType const& Status, bool IsRemoved) override
|
||||
// {
|
||||
// fprintf(stdout, "ReportDeviceStatus: Status.OperationStatus.Mode set? %d\n", !(int)Status.OperationStatus.Mode.empty());
|
||||
// }
|
||||
// };
|
||||
|
||||
|
||||
// int main(int argc, char *argv[])
|
||||
// {
|
||||
// std::cout << "App started ..." << std::endl;
|
||||
|
||||
// const int domain = 4; // TMS-IF MAVLink Adapter runs on domain 4
|
||||
// ddkit::actors::Session session(domain);
|
||||
|
||||
// // starting Service
|
||||
// const std::string serviceName = "UAV_Device1";
|
||||
|
||||
// // client
|
||||
// DeviceClient callbacksFromServices;
|
||||
// auto client = M_Device::Client::create(session, serviceName, callbacksFromServices);
|
||||
|
||||
// while(true) // keep app running
|
||||
// {
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
// }
|
||||
|
||||
// return 0;
|
||||
// }
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
#include <TmsIfAdapter/tms_if.h>
|
||||
|
||||
|
||||
int main(int , char *[])
|
||||
{
|
||||
std::cout << "App started ..." << std::endl;
|
||||
|
||||
UAS::TmsIfAdapter::get().test();
|
||||
|
||||
std::cout << "Now waiting ..." << std::endl;
|
||||
|
||||
|
||||
// keep app running:
|
||||
while(true){std::this_thread::sleep_for(std::chrono::milliseconds(500));}
|
||||
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
|
||||
// std::string blub;
|
||||
// std::cin >> blub;
|
||||
|
||||
std::cout << "Stopping ..." << std::endl;
|
||||
|
||||
UAS::TmsIfAdapter::stop();
|
||||
|
||||
std::cout << "Stopped ..." << std::endl;
|
||||
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
||||
|
||||
std::cout << "Exit ..." << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
#include <dlfcn.h> // TODO: no UAS for windoof
|
||||
|
||||
#include <TmsIfAdapter/tms_if_adapter.h>
|
||||
|
||||
|
||||
using GetFn = void *(*)();
|
||||
|
||||
|
||||
int main(int , char *[])
|
||||
{
|
||||
std::cout << "App started ..." << std::endl;
|
||||
|
||||
void *handle = dlopen("libTmsIfAdapter.so", RTLD_NOW | RTLD_LOCAL | RTLD_DEEPBIND);
|
||||
|
||||
if (handle == nullptr)
|
||||
{
|
||||
std::cerr << "no libTmsIfAdapter.so :( => " << dlerror() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto get = reinterpret_cast<GetFn>(dlsym(handle, "get"));
|
||||
if (get == nullptr)
|
||||
{
|
||||
std::cerr << "no 'get' in libTmsIfAdapter.so :( => " << dlerror() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
UAS::TmsIfAdapter *adapter = reinterpret_cast<UAS::TmsIfAdapter *>(get());
|
||||
|
||||
|
||||
// adapter->test();
|
||||
|
||||
|
||||
std::cout << "Now waiting ..." << std::endl;
|
||||
|
||||
|
||||
// keep app running:
|
||||
while(true){std::this_thread::sleep_for(std::chrono::milliseconds(500));}
|
||||
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
|
||||
// std::string blub;
|
||||
// std::cin >> blub;
|
||||
|
||||
std::cout << "Stopping ..." << std::endl;
|
||||
|
||||
// UAS::TmsIfAdapter::stop();
|
||||
|
||||
std::cout << "Stopped ..." << std::endl;
|
||||
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
||||
|
||||
std::cout << "Exit ..." << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
|
||||
int main(int , char *[])
|
||||
{
|
||||
std::cout << "App started ..." << std::endl;
|
||||
|
||||
std::cout << "Now waiting ..." << std::endl;
|
||||
|
||||
while(true){std::this_thread::sleep_for(std::chrono::milliseconds(500));}
|
||||
|
||||
std::cout << "Exit ..." << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#include <QApplication>
|
||||
#include <QTimer>
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
#include <dlfcn.h> // TODO: no UAS for windoof
|
||||
|
||||
#include <TmsIfAdapter/module_loader.h>
|
||||
#include <TmsIfAdapter/tms_if_adapter.h>
|
||||
#include <TmsIfAdapter/uav_commander.h>
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
|
||||
std::cout << "App started ..." << std::endl;
|
||||
|
||||
UAS::ModuleLoader::dlopen_handle handle = UAS::ModuleLoader::load("../lib/");
|
||||
|
||||
/*auto &adapter =*/ UAS::ModuleLoader::get(handle);
|
||||
|
||||
app.exec();
|
||||
|
||||
std::cout << "Stopping ..." << std::endl;
|
||||
|
||||
UAS::ModuleLoader::unload(handle);
|
||||
|
||||
std::cout << "Stopped ..." << std::endl;
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
||||
|
||||
std::cout << "Exit ..." << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user