本文整理汇总了C++中Agent::getPose方法的典型用法代码示例。如果您正苦于以下问题:C++ Agent::getPose方法的具体用法?C++ Agent::getPose怎么用?C++ Agent::getPose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Agent
的用法示例。
在下文中一共展示了Agent::getPose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: positionsCallback
void SimpleDeploymentDummy::positionsCallback(const turtlebot_deployment::PoseWithName::ConstPtr& posePtr)
{
ROS_DEBUG("SimpleDeployment: Positions received, finding robot in database");
// Search for agent in the catalog using functor that compares the name to an input string
std::vector<Agent>::iterator it = std::find_if(agent_catalog_.begin(), agent_catalog_.end(), MatchString(posePtr->name) );
// If the agent is already in the catalog, update the position and recalculate the distance.
if ( it != agent_catalog_.end() ) {
ROS_DEBUG("SimpleDeployment: Robot found, updating pose and distance");
it->setPose(posePtr->pose);
it->setDistance(distance(this_agent_.getPose(),posePtr->pose));
}
// else (the agent is not yet in the catalog), create an Agent object and push it into the catalog vector
else {
ROS_DEBUG("SimpleDeployment: Robot not found in database");
if ( posePtr->name != this_agent_.getName() ) {
ROS_DEBUG("SimpleDeployment: Robot is not me. Adding it to database");
// This initializes an object called "agent" with id = 1, the pose of the incoming message, and the distance from this agent to the agent that published the message
Agent agent( 1, *posePtr, distance(this_agent_.getPose(), posePtr->pose) );
agent_catalog_.push_back( agent );
}
else {
ROS_ERROR("SimpleDeployment: Robot is me! Updating position and adding to database");
this_agent_.setPose(posePtr->pose);
got_me_ = true;
// This initializes an object called "agent" with id = 0, the pose of the incoming message, and a distance of 0.0;
Agent agent( 0, *posePtr, 0.0 );
agent_catalog_.push_back( agent );
}
}
// Sort agent list on distance (using functor)
std::sort( agent_catalog_.begin(), agent_catalog_.end(), SortAgentsOnDistance() );
ROS_DEBUG("SimpleDeployment: Positions processed");
}