Skip to content
Snippets Groups Projects
Commit 0cefa8d9 authored by Mirko Wächter's avatar Mirko Wächter
Browse files

extensions for multi robot setup

parent 97048062
No related branches found
No related tags found
No related merge requests found
Showing
with 37 additions and 5 deletions
......@@ -116,7 +116,7 @@ namespace armarx
{
ARMARX_VERBOSE << "Node: " << node->getName() << endl;
}
usingTopic(robotNodeSetName + "State");
usingTopic(getProperty<std::string>("TopicPrefix").getValue() + robotNodeSetName + "State");
try
{
......
......@@ -57,6 +57,8 @@ namespace armarx
defineOptionalProperty<std::string>("RobotStateReportingTopic", "RobotStateUpdates", "Name of the topic on which updates of the robot state are reported.");
defineOptionalProperty<int>("HistoryLength", 10000, "Number of entries in the robot state history");
defineOptionalProperty<float>("RobotModelScaling", 1.0f, "Scaling of the robot model");
defineOptionalProperty<std::string>("TopicPrefix", "", "Prefix for the sensor value topic name.");
}
};
......
......@@ -99,7 +99,7 @@ void KinematicUnit::onInitComponent()
robotNodes = robotNodeSetPtr->getAllRobotNodes();
// component dependencies
listenerName = robotNodeSetName + "State";
listenerName = getProperty<std::string>("TopicPrefix").getValue() + robotNodeSetName + "State";
offeringTopic(listenerName);
this->onInitKinematicUnit();
......
......@@ -51,6 +51,7 @@ namespace armarx
defineRequiredProperty<std::string>("RobotNodeSetName", "Robot node set name as defined in robot xml file, e.g. 'LeftArm'");
defineRequiredProperty<std::string>("RobotFileName", "Robot file name, e.g. robot_model.xml");
defineOptionalProperty<std::string>("RobotFileNameProject", "", "Project in which the robot filename is located (if robot is loaded from an external project)");
defineOptionalProperty<std::string>("TopicPrefix", "", "Prefix for the sensor value topic name.");
}
};
......
......@@ -56,7 +56,7 @@ void KinematicUnitObserver::onInitObserver()
offerConditionCheck("larger", new ConditionCheckLarger());
offerConditionCheck("smaller", new ConditionCheckSmaller());
usingTopic(robotNodeSetName + "State");
usingTopic(getProperty<std::string>("TopicPrefix").getValue() + robotNodeSetName + "State");
}
void KinematicUnitObserver::onConnectObserver()
......
......@@ -48,6 +48,8 @@ namespace armarx
defineRequiredProperty<std::string>("RobotNodeSetName", "Robot node set name as defined in robot xml file, e.g. 'LeftArm'");
defineRequiredProperty<std::string>("RobotFileName", "Robot file name, e.g. robot_model.xml");
defineOptionalProperty<std::string>("RobotFileNameProject", "", "Project in which the robot filename is located (if robot is loaded from an external project)");
defineOptionalProperty<std::string>("TopicPrefix", "", "Prefix for the sensor value topic name.");
}
};
......
......@@ -41,6 +41,11 @@ namespace armarx
return robotPlatformName;
}
std::string RobotData::getRobotPlatformInstanceName() const
{
return robotPlatformInstanceName;
}
const std::string& RobotData::getRobotNodetSeName() const
{
throwIfInControlThread(BOOST_CURRENT_FUNCTION);
......@@ -82,6 +87,8 @@ namespace armarx
return clone;
}
void RobotData::_initVirtualRobot()
{
throwIfInControlThread(BOOST_CURRENT_FUNCTION);
......@@ -94,6 +101,7 @@ namespace armarx
robotProjectName = getProperty<std::string>("RobotFileNameProject").getValue();
robotFileName = getProperty<std::string>("RobotFileName").getValue();
robotPlatformName = getProperty<std::string>("PlatformName").getValue();
robotPlatformInstanceName = getProperty<std::string>("PlatformInstanceName").getValue();
//load robot
{
......
......@@ -55,7 +55,11 @@ namespace armarx
"Robot node set name as defined in robot xml file, e.g. 'LeftArm'");
defineOptionalProperty<std::string>(
"PlatformName", "Platform",
"Name of the platform (will publish values on PlatformName + 'State')");
"Name of the platform needs to correspond to a node in the virtual robot.");
defineOptionalProperty<std::string>(
"PlatformInstanceName", "Platform",
"Name of the platform instance (will publish values on PlatformInstanceName + 'State')");
}
};
......@@ -114,6 +118,12 @@ namespace armarx
*/
std::string getRobotName() const;
/**
* @brief Returns the name of the robot platform instance. Used for the platform topic: RobotPlatformInstance + "State"
*/
std::string getRobotPlatformInstanceName() const;
/**
* @brief Returns a clone of the robot's model
* @return A clone of the robot's model
......@@ -122,6 +132,7 @@ namespace armarx
// //////////////////////////////////////////////////////////////////////////////////////// //
// ///////////////////////////////////////// Data ///////////////////////////////////////// //
// //////////////////////////////////////////////////////////////////////////////////////// //
private:
/// @brief The name of the robot's RobotNodeSet
std::string robotNodeSetName;
......@@ -131,6 +142,8 @@ namespace armarx
std::string robotFileName;
/// @brief The name of the robot's platform
std::string robotPlatformName;
/// @brief The name of the robot's platform instance
std::string robotPlatformInstanceName;
/// @brief The robot's model.
VirtualRobot::RobotPtr robot;
......
......@@ -266,6 +266,8 @@ namespace armarx
properties->setProperty(confPre + "RobotNodeSetName", _module<RobotData>().getRobotNodetSeName());
properties->setProperty(confPre + "RobotFileName", _module<RobotData>().getRobotFileName());
properties->setProperty(confPre + "RobotFileNameProject", _module<RobotData>().getRobotProjectName());
properties->setProperty(confPre + "TopicPrefix", getProperty<std::string>("KinematicUnitNameTopicPrefix"));
ARMARX_DEBUG << "creating unit " << configName << " using these properties: " << properties->getPropertiesForPrefix("");
IceInternal::Handle<UnitT> unit = Component::create<UnitT>(properties, configName, getConfigDomain());
......@@ -317,7 +319,7 @@ namespace armarx
Ice::PropertiesPtr properties = getIceProperties()->clone();
//properties->setProperty(confPre + "MinimumLoggingLevel", getProperty<std::string>("MinimumLoggingLevel").getValue());
//fill properties
properties->setProperty(confPre + "PlatformName", _module<RobotData>().getRobotPlatformName());
properties->setProperty(confPre + "PlatformName", _module<RobotData>().getRobotPlatformInstanceName());
ARMARX_DEBUG << "creating unit " << configName << " using these properties: " << properties->getPropertiesForPrefix("");
IceInternal::Handle<UnitT> unit = Component::create<UnitT>(properties, configName, getConfigDomain());
//config
......
......@@ -39,6 +39,10 @@ namespace armarx
defineOptionalProperty<std::string>(
"KinematicUnitName", "KinematicUnit",
"The name of the created kinematic unit");
defineOptionalProperty<std::string>(
"KinematicUnitNameTopicPrefix", "",
"Prefix for the kinematic sensor values topic");
defineOptionalProperty<std::string>(
"PlatformUnitName", "PlatformUnit",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment