Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "romeo_moveit_actions/toolsForObject.hpp"
00018
00019 namespace moveit_simple_actions
00020 {
00021
00022 void setPose(geometry_msgs::Pose *pose,
00023 const double &x,
00024 const double &y,
00025 const double &z,
00026 const double &ox,
00027 const double &oy,
00028 const double &oz,
00029 const double &ow)
00030 {
00031 pose->position.x = x;
00032 pose->position.y = y;
00033 pose->position.z = z;
00034 pose->orientation.x = ox;
00035 pose->orientation.y = oy;
00036 pose->orientation.z = oz;
00037 pose->orientation.w = ow;
00038 }
00039
00040 void setPose(geometry_msgs::Pose *pose,
00041 const double &x,
00042 const double &y,
00043 const double &z)
00044 {
00045 pose->position.x = x;
00046 pose->position.y = y;
00047 pose->position.z = z;
00048 }
00049
00050 int findObj(std::vector<MetaBlock> *blocks,
00051 const std::string name)
00052 {
00053 int idx = -1;
00054 for (int i=0; i<blocks->size(); ++i)
00055 if (blocks->at(i).name_ == name){
00056 idx = i;
00057 return idx;
00058 }
00059 return idx;
00060 }
00061
00062 std::vector<std::string> getObjectsList(const std::vector<MetaBlock> &blocks)
00063 {
00064 std::vector<std::string> res;
00065 res.resize(blocks.size());
00066 if (blocks.size() > 0)
00067 {
00068 std::vector<MetaBlock>::const_iterator it=blocks.begin();
00069 for (int i=0; it!=blocks.end(); ++it, ++i)
00070 res[i] = it->name_;
00071 }
00072 return res;
00073 }
00074
00075
00076 std::vector<std::string> getObjectsOldList(std::vector<MetaBlock> *objects)
00077 {
00078 std::vector<std::string> objects_id;
00079 if (objects->size()>0)
00080 {
00081 ros::Time now = ros::Time::now() - ros::Duration(5);
00082 std::vector<MetaBlock>::iterator block=objects->begin();
00083 for (; block != objects->end(); ++block)
00084 {
00085 if (block->timestamp_ < now)
00086 objects_id.push_back(block->name_);
00087
00088 }
00089 }
00090 return objects_id;
00091 }
00092
00093 void swapPoses(geometry_msgs::Pose *pose1,
00094 geometry_msgs::Pose *pose2)
00095 {
00096 geometry_msgs::Pose temp = *pose1;
00097 pose1 = pose2;
00098 *pose2 = temp;
00099 }
00100
00101 }