10 #include <moveit_msgs/DisplayRobotState.h> 11 #include <moveit_msgs/DisplayTrajectory.h> 13 #include <moveit_msgs/AttachedCollisionObject.h> 14 #include <moveit_msgs/CollisionObject.h> 17 #include <std_msgs/Bool.h> 18 #include <xarm_planner/pose_plan.h> 19 #include <xarm_planner/joint_plan.h> 20 #include <xarm_planner/exec_plan.h> 21 #include <xarm_planner/single_straight_plan.h> 23 #define SPINNER_THREAD_NUM 2 61 bool do_pose_plan(xarm_planner::pose_plan::Request &req, xarm_planner::pose_plan::Response &res);
62 bool do_joint_plan(xarm_planner::joint_plan::Request &req, xarm_planner::joint_plan::Response &res);
63 bool do_single_cartesian_plan(xarm_planner::single_straight_plan::Request &req, xarm_planner::single_straight_plan::Response &res);
64 bool exec_plan_cb(xarm_planner::exec_plan::Request &req, xarm_planner::exec_plan::Response &res);
88 Eigen::Isometry3d text_pose = Eigen::Isometry3d::Identity();
89 text_pose.translation().z() = 0.8;
110 ROS_INFO_NAMED(
"xarm_planner",
"Visualizing plan as trajectory line");
123 ROS_INFO(
"xarm_planner received new target: [ position: (%f, %f, %f), orientation: (%f, %f, %f, %f)", \
124 req.target.position.x, req.target.position.y, req.target.position.z, req.target.orientation.x, \
125 req.target.orientation.y, req.target.orientation.z, req.target.orientation.w);
128 res.success = success;
129 ROS_INFO_NAMED(
"move_group_planner",
"This plan (pose goal) %s", success ?
"SUCCEEDED" :
"FAILED");
138 std::vector<geometry_msgs::Pose> waypoints;
139 waypoints.push_back(req.target);
151 fprintf(
stderr,
"[XArmSimplePlanner::do_single_cartesian_plan(): ] Coverage: %lf\n", fraction);
153 res.success = success;
162 ROS_INFO(
"move_group_planner received new plan Request");
166 res.success = success;
167 ROS_INFO_NAMED(
"move_group_planner",
"This plan (joint goal) %s", success ?
"SUCCEEDED" :
"FAILED");
176 ROS_INFO(
"Received Execution Service Request");
178 res.success = finish_ok;
191 ROS_INFO(
"Received Execution Command !!!!!");
199 int main(
int argc,
char** argv)
201 ros::init(argc, argv,
"xarm_move_group_planner");
224 ROS_ERROR(
"ROS parameter DOF not correct, please CHECK!!");
232 ROS_INFO(
"Waiting for \'pose_plan\' or \'joint_plan\' service Request ...");
const double jump_threshold
moveit_msgs::RobotTrajectory trajectory_
#define ROS_INFO_NAMED(name,...)
moveit_visual_tools::MoveItVisualTools * visual_tools
ros::AsyncSpinner spinner
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
bool setJointValueTarget(const std::vector< double > &group_variable_values)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ros::Subscriber exec_plan_sub
double computeCartesianPath(const std::vector< geometry_msgs::Pose > &waypoints, double eef_step, double jump_threshold, moveit_msgs::RobotTrajectory &trajectory, bool avoid_collisions=true, moveit_msgs::MoveItErrorCodes *error_code=NULL)
bool setPoseTarget(const Eigen::Affine3d &end_effector_pose, const std::string &end_effector_link="")
const double maxV_scale_factor
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
bool do_single_cartesian_plan(xarm_planner::single_straight_plan::Request &req, xarm_planner::single_straight_plan::Response &res)
bool do_pose_plan(xarm_planner::pose_plan::Request &req, xarm_planner::pose_plan::Response &res)
const std::string & getPlanningFrame() const
const std::string & getEndEffectorLink() const
ros::ServiceServer sing_cart_srv
ros::ServiceServer exec_plan_srv
void show_trail(bool plan_result)
ros::NodeHandle node_handle
bool exec_plan_cb(xarm_planner::exec_plan::Request &req, xarm_planner::exec_plan::Response &res)
MoveItErrorCode asyncExecute(const Plan &plan)
static std::string PLANNING_GROUP
ros::ServiceServer plan_pose_srv
ros::ServiceServer plan_joint_srv
robot_trajectory::RobotTrajectory trajectory(rmodel,"right_arm")
robot_state::RobotStatePtr getCurrentState(double wait=1)
void setMaxVelocityScalingFactor(double max_velocity_scaling_factor)
moveit::planning_interface::PlanningSceneInterface planning_scene_interface
XArmSimplePlanner(const std::string plan_group_name)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
MoveItErrorCode execute(const Plan &plan)
void execute_plan_topic(const std_msgs::Bool::ConstPtr &exec)
MoveItErrorCode plan(Plan &plan)
moveit::planning_interface::MoveGroupInterface::Plan my_xarm_plan
bool getParam(const std::string &key, std::string &s) const
const std::vector< std::string > & getJointNames()
std::vector< std::string > joint_names
ros::Publisher display_path
int main(int argc, char **argv)
moveit::planning_interface::MoveGroupInterface group
#define SPINNER_THREAD_NUM
ROSCPP_DECL void waitForShutdown()
bool do_joint_plan(xarm_planner::joint_plan::Request &req, xarm_planner::joint_plan::Response &res)