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 #include <bipedRobin_footstep_planner/FootstepPlannerNode.h>
00025 #include <tf/transform_listener.h>
00026 
00027 
00028 
00029 namespace footstep_planner
00030 {
00031 
00032         FootstepPlannerNodeNew::FootstepPlannerNodeNew()
00033         {
00034                 ros::NodeHandle nh;     
00035 
00036                 
00037                 ivGridMapSub = nh.subscribe<nav_msgs::OccupancyGrid>("map", 1, &FootstepPlanner::mapCallback, &ivFootstepPlanner);
00038                 ivGoalPoseSub = nh.subscribe<geometry_msgs::PoseStamped>("goal", 1, &FootstepPlanner::goalPoseCallback, &ivFootstepPlanner);
00039                 ivStartPoseSub = nh.subscribe<geometry_msgs::PoseWithCovarianceStamped>("initialpose", 1, &FootstepPlanner::startPoseCallback, &ivFootstepPlanner);
00040 
00041                 
00042                 ivFootstepPlanService = nh.advertiseService("plan_footsteps", &FootstepPlanner::planService, &ivFootstepPlanner);
00043                 
00044                 initialsteps_srv = nh.advertiseService("initialSteps_srv", &FootstepPlannerNodeNew::initialStepsCallback, this);        
00045                 
00046                 ivFootstepPlanner.plan();
00047                 
00048         }
00049 
00050         FootstepPlannerNodeNew::~FootstepPlannerNodeNew()
00051         {}
00052         
00053         
00054         bool    FootstepPlannerNodeNew::initialStepsCallback(bipedRobin_msgs::InitialStepsService::Request &req, bipedRobin_msgs::InitialStepsService::Response &res) {  
00055         
00056                 double x, y, yaw, pitch, roll;
00057 
00058                 btMatrix3x3(btQuaternion(req.left.pose.orientation.x, req.left.pose.orientation.y, req.left.pose.orientation.z, req.left.pose.orientation.w)).getEulerYPR(yaw, pitch, roll);    
00059 
00060                 x = req.left.pose.position.x;
00061                 y = req.left.pose.position.y;
00062 
00063                 State left = State(x,y,yaw,LEFT); 
00064 
00065                 btMatrix3x3(btQuaternion(req.right.pose.orientation.x, req.right.pose.orientation.y, req.right.pose.orientation.z, req.right.pose.orientation.w)).getEulerYPR(yaw, pitch, roll);        
00066 
00067                 x = req.right.pose.position.x;
00068                 y = req.right.pose.position.y;
00069 
00070                 State right = State(x,y,yaw,RIGHT); 
00071                 ivFootstepPlanner.setStart(left, right); 
00072                 return true;
00073         }
00074         
00075 }