Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #include <kinematics_cache_ros/kinematics_cache_ros.h>
00039 #include <ros/ros.h>
00040
00041 int main(int argc, char** argv)
00042 {
00043 ros::init(argc, argv, "kinematics_cache");
00044 kinematics_cache::KinematicsCache::Options opt;
00045 opt.origin.x = 0.0;
00046 opt.origin.y = -1.0;
00047 opt.origin.z = -1.0;
00048
00049 opt.workspace_size[0] = 2.0;
00050 opt.workspace_size[1] = 2.0;
00051 opt.workspace_size[2] = 2.0;
00052
00053 opt.resolution[0] = 0.01;
00054 opt.resolution[1] = 0.01;
00055 opt.resolution[2] = 0.01;
00056 opt.max_solutions_per_grid_location = 2;
00057
00058 kinematics_cache_ros::KinematicsCacheROS pr2_kinematics_cache;
00059 ros::NodeHandle private_handle("~");
00060
00061 if (!pr2_kinematics_cache.init(opt, "pr2_arm_kinematics/PR2ArmKinematicsPlugin", "right_arm", "torso_lift_link",
00062 "r_wrist_roll_link", 0.01))
00063 return (0);
00064
00065 pr2_kinematics_cache.generateCacheMap(10.0);
00066
00067 geometry_msgs::Pose point;
00068 point.position.x = 0.0;
00069 point.position.y = -1.0;
00070 point.position.z = -1.0;
00071
00072 unsigned int max_num = 200;
00073
00074 for (unsigned int i = 0; i < max_num; ++i)
00075 {
00076 point.position.x = opt.origin.x + i / 100.0;
00077 for (unsigned int j = 0; j < max_num; ++j)
00078 {
00079 point.position.y = opt.origin.y + j / 100.0;
00080 for (unsigned int k = 0; k < max_num; ++k)
00081 {
00082 point.position.z = opt.origin.z + k / 100.0;
00083 unsigned int num_solutions(0);
00084 if (!pr2_kinematics_cache.getNumSolutions(point, num_solutions))
00085 ROS_ERROR("Outside grid");
00086 else if (num_solutions > 0)
00087 ROS_INFO("Num solutions: %d", num_solutions);
00088 }
00089 }
00090 }
00091 return (0);
00092 }