58 open_manipulator_msgs::GetJointPosition::Response &res)
66 for (std::size_t i = 0; i < joint_names.size(); i++)
68 res.joint_position.joint_name.push_back(joint_names[i]);
69 res.joint_position.position.push_back(joint_values[i]);
77 open_manipulator_msgs::GetKinematicsPose::Response &res)
84 res.header = current_pose.header;
85 res.kinematics_pose.pose = current_pose.pose;
92 open_manipulator_msgs::SetJointPosition::Response &res)
94 open_manipulator_msgs::JointPosition msg = req.joint_position;
101 open_manipulator_msgs::SetKinematicsPose::Response &res)
103 open_manipulator_msgs::KinematicsPose msg = req.kinematics_pose;
114 bool is_planned =
false;
115 geometry_msgs::Pose target_pose = msg.pose;
126 bool success = (
move_group_->
plan(my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
134 ROS_WARN(
"Planning (task space goal) is FAILED");
148 bool is_planned =
false;
154 std::vector<double> joint_group_positions;
155 current_state->copyJointGroupPositions(joint_model_group, joint_group_positions);
157 uint8_t joint_num = msg.position.size();
160 joint_group_positions[
index] = msg.position[
index];
170 bool success = (
move_group_->
plan(my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
178 ROS_WARN(
"Planning (joint space goal) is FAILED");
191 trajectory_msgs::JointTrajectory jnt_tra = msg->trajectory[0].joint_trajectory;
192 std_msgs::Float64MultiArray jnt_tra_pts;
196 for (std::vector<uint32_t>::size_type i = 0; i < jnt_tra.points.size(); i++)
198 jnt_tra_pts.data.push_back(jnt_tra.points[i].time_from_start.toSec());
199 for (std::vector<uint32_t>::size_type j = 0; j < jnt_tra.points[i].positions.size(); j++)
201 jnt_tra_pts.data.push_back(jnt_tra.points[i].positions[j]);
209 uint32_t all_points_size = jnt_tra.points.size();
210 const uint8_t POINTS_STEP_SIZE = 10;
211 uint32_t steps = floor((
double)all_points_size/(
double)POINTS_STEP_SIZE);
213 for (uint32_t i = 0; i < all_points_size; i = i + steps)
215 jnt_tra_pts.data.push_back(jnt_tra.points[i].time_from_start.toSec());
216 for (std::vector<uint32_t>::size_type j = 0; j < jnt_tra.points[i].positions.size(); j++)
218 jnt_tra_pts.data.push_back(jnt_tra.points[i].positions[j]);
226 int main(
int argc,
char **argv)
void publish(const boost::shared_ptr< M > &message) const
moveit::planning_interface::MoveGroupInterface * move_group_
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)
std::string planning_group_
bool getKinematicsPoseMsgCallback(open_manipulator_msgs::GetKinematicsPose::Request &req, open_manipulator_msgs::GetKinematicsPose::Response &res)
bool setJointPositionMsgCallback(open_manipulator_msgs::SetJointPosition::Request &req, open_manipulator_msgs::SetJointPosition::Response &res)
std::vector< double > getCurrentJointValues()
ros::ServiceServer get_kinematics_pose_server_
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool setPoseTarget(const Eigen::Affine3d &end_effector_pose, const std::string &end_effector_link="")
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
int main(int argc, char **argv)
ros::ServiceServer set_joint_position_server_
ros::Subscriber display_planned_path_sub_
ros::ServiceServer set_kinematics_pose_server_
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
ros::ServiceServer get_joint_position_server_
robot_state::RobotStatePtr getCurrentState(double wait=1)
void setMaxVelocityScalingFactor(double max_velocity_scaling_factor)
ros::Publisher joint_trajectory_point_pub_
void displayPlannedPathMsgCallback(const moveit_msgs::DisplayTrajectory::ConstPtr &msg)
bool setKinematicsPoseMsgCallback(open_manipulator_msgs::SetKinematicsPose::Request &req, open_manipulator_msgs::SetKinematicsPose::Response &res)
geometry_msgs::PoseStamped getCurrentPose(const std::string &end_effector_link="")
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
MoveItErrorCode plan(Plan &plan)
bool getJointPositionMsgCallback(open_manipulator_msgs::GetJointPosition::Request &req, open_manipulator_msgs::GetJointPosition::Response &res)
void setGoalTolerance(double tolerance)
const std::vector< std::string > & getJointNames()
bool calcPlannedPath(const std::string planning_group, open_manipulator_msgs::JointPosition msg)
ROSCPP_DECL void shutdown()
void setMaxAccelerationScalingFactor(double max_acceleration_scaling_factor)
ROSCPP_DECL void spinOnce()