Skip to content
Snippets Groups Projects
Commit 33bcc3f0 authored by themarex's avatar themarex
Browse files

Add utility function to get sensor by name

git-svn-id: http://svn.code.sf.net/p/simox/code/trunk@641 042f3d55-54a8-47e9-b7fb-15903f145c44
parent 93eef5ab
No related branches found
No related tags found
No related merge requests found
......@@ -818,6 +818,24 @@ VirtualRobot::BoundingBox Robot::getBoundingBox(bool collisionModel)
return bbox;
}
SensorPtr Robot::getSensor(const std::string& name)
{
std::vector<RobotNodePtr> rn = getRobotNodes();
for (size_t i=0;i<rn.size();i++)
{
std::vector<SensorPtr> sensors = rn[i]->getSensors();
for (std::vector<SensorPtr>::iterator it = sensors.begin(); it != sensors.end(); it++)
{
if ((*it)->getName() == name)
{
return *it;
}
}
}
return SensorPtr();
}
std::vector<SensorPtr> Robot::getSensors()
{
std::vector<SensorPtr> result;
......
......@@ -364,6 +364,11 @@ public:
*/
BoundingBox getBoundingBox(bool collisionModel = true);
/*!
* Returns the sensor with the given name.
*/
SensorPtr getSensor(const std::string& name);
/*!
Returns all sensors that are defined within this robot.
*/
......
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