mirror of
https://github.com/micro-ROS/micro-ROS-Agent.git
synced 2026-09-06 09:55:15 +02:00
Modify callbacks init
This commit is contained in:
@@ -51,7 +51,7 @@ public:
|
||||
void stop();
|
||||
|
||||
private:
|
||||
|
||||
bool initialized = false;
|
||||
eprosima::uxr::AgentInstance& xrce_dds_agent_instance_;
|
||||
std::map<eprosima::fastdds::dds::DomainId_t, std::shared_ptr<graph_manager::GraphManager>> graph_manager_map_;
|
||||
|
||||
|
||||
@@ -23,6 +23,26 @@ namespace agent {
|
||||
Agent::Agent()
|
||||
: xrce_dds_agent_instance_(xrce_dds_agent_instance_.getInstance())
|
||||
{
|
||||
}
|
||||
|
||||
Agent& Agent::getInstance()
|
||||
{
|
||||
static Agent instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
bool Agent::create(
|
||||
int argc,
|
||||
char** argv)
|
||||
{
|
||||
stop();
|
||||
|
||||
bool result = xrce_dds_agent_instance_.create(argc, argv);
|
||||
|
||||
if (result && !initialized)
|
||||
{
|
||||
initialized = true;
|
||||
|
||||
/**
|
||||
* Add CREATE_PARTICIPANT callback.
|
||||
*/
|
||||
@@ -159,18 +179,7 @@ Agent::Agent()
|
||||
std::move(on_delete_datareader));
|
||||
}
|
||||
|
||||
Agent& Agent::getInstance()
|
||||
{
|
||||
static Agent instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
bool Agent::create(
|
||||
int argc,
|
||||
char** argv)
|
||||
{
|
||||
stop();
|
||||
return xrce_dds_agent_instance_.create(argc, argv);
|
||||
return result;
|
||||
}
|
||||
|
||||
void Agent::run()
|
||||
|
||||
Reference in New Issue
Block a user