geometry_msgs::Pose util::actionToMovement(int action) { static std::map< int, geometry_msgs::Pose > actionToMovement; static bool initialized = false; if(!initialized) { actionToMovement[pacman_interface::PacmanAction::NORTH] = createPose( 0, 1); actionToMovement[pacman_interface::PacmanAction::SOUTH] = createPose( 0,-1); actionToMovement[pacman_interface::PacmanAction::EAST] = createPose( 1, 0); actionToMovement[pacman_interface::PacmanAction::WEST] = createPose(-1, 0); actionToMovement[pacman_interface::PacmanAction::STOP] = createPose( 0, 0); initialized = true; } return actionToMovement[action]; }
geometry_msgs::Pose util::move(geometry_msgs::Pose agent_pose, int action) { static std::map< int, geometry_msgs::Pose > actionToMovement; static bool initialized = false; if(!initialized) { actionToMovement[pacman_interface::PacmanAction::NORTH] = createPose( 0, 1); actionToMovement[pacman_interface::PacmanAction::SOUTH] = createPose( 0,-1); actionToMovement[pacman_interface::PacmanAction::EAST] = createPose( 1, 0); actionToMovement[pacman_interface::PacmanAction::WEST] = createPose(-1, 0); actionToMovement[pacman_interface::PacmanAction::STOP] = createPose( 0, 0); initialized = true; } geometry_msgs::Pose new_pose; new_pose.position.x = agent_pose.position.x + actionToMovement[action].position.x; new_pose.position.y = agent_pose.position.y + actionToMovement[action].position.y; return new_pose; }
Affine3 EuclidDistHeuristic::createPose( const std::vector<double> &pose) const { return createPose(pose[0], pose[1], pose[2], pose[5], pose[4], pose[3]); }