void RobotReader::Publish(struct toasterList_t& list_msg) { if(activated_) { for (std::map<std::string, Robot *>::iterator it = lastConfig_.begin(); it != lastConfig_.end(); ++it) { toaster_msgs::Fact fact_msg = DefaultFactMsg(it->first, it->second->getTime()); list_msg.fact_msg.factList.push_back(fact_msg); //Robot toaster_msgs::Robot robot_msg; robot_msg.meAgent.mobility = 0; fillEntity(lastConfig_[it->first], robot_msg.meAgent.meEntity); if (fullRobot_) { for (std::map<std::string, Joint *>::iterator itJoint = lastConfig_[it->first]->skeleton_.begin(); itJoint != lastConfig_[it->first]->skeleton_.end(); ++itJoint) { toaster_msgs::Joint joint_msg; robot_msg.meAgent.skeletonNames.push_back(itJoint->first); fillEntity((itJoint->second), joint_msg.meEntity); joint_msg.jointOwner = it->first; joint_msg.position = itJoint->second->position; robot_msg.meAgent.skeletonJoint.push_back(joint_msg); } } list_msg.robot_msg.robotList.push_back(robot_msg); } } }
void fillSearchResponse(const aminer::EntitySearchRequest& request, aminer::EntitySearchResponse& response, const indexing::SearchResult& result) { int offset = request.has_offset() ? request.offset() : 0; int count = request.has_count() ? request.count() : 50; auto vi = ig->g->Vertices(); for (int ri = offset; ri < result.size() && ri - offset < count; ri++) { vi->MoveTo(result[ri].docId); fillEntity(response.add_entity(), vi.get()); } response.set_query(request.query()); response.set_total_count(result.size()); }