I am working on a RPP robot with and end effector with 1dof. The robot is designed to work in a mirco channel printing station. I run the cpp code given below to move my robot to two points. `
#include
#include
#include
#include
#include
#include
int main(int argc, char **argv)
{
ros::init(argc, argv, "move_group_interface_tutorial");
ros::NodeHandle node_handle;
ros::AsyncSpinner spinner(1);
spinner.start();
/* This sleep is ONLY to allow Rviz to come up */
sleep(2.0);
// BEGIN_TUTORIAL
//
// Setup
// ^^^^^
//
// The :move_group_interface:`MoveGroup` class can be easily
// setup using just the name
// of the group you would like to control and plan for.
moveit::planning_interface::MoveGroupInterface group("arm");
// We will use the :planning_scene_interface:`PlanningSceneInterface`
// class to deal directly with the world.
moveit::planning_interface::PlanningSceneInterface planning_scene_interface;
// (Optional) Create a publisher for visualizing plans in Rviz.
ros::Publisher display_publisher = node_handle.advertise("/move_group/display_planned_path", 1, true);
moveit_msgs::DisplayTrajectory display_trajectory;
// Getting Basic Information
// ^^^^^^^^^^^^^^^^^^^^^^^^^
//
// We can print the name of the reference frame for this robot.
ROS_INFO("Reference frame: %s", group.getPlanningFrame().c_str());
// We can also print the name of the end-effector link for this group.
ROS_INFO("Reference frame: %s", group.getEndEffectorLink().c_str());
// Planning to a Pose goal
// ^^^^^^^^^^^^^^^^^^^^^^^
// We can plan a motion for this group to a desired pose for the
// end-effector.
// point one
group.setStartStateToCurrentState ();
group.setPositionTarget(-0.147,-0.244,0.278,"finger");
group.move();
//point two
group.setStartStateToCurrentState ();
group.setPositionTarget(-0.282,0.009,0.278,"finger");
group.move();
ros::waitForShutdown();
sleep(5.0);
// END_TUTORIAL
ros::shutdown();
return 0;
}
But the result obtained (step by step) is:
STEP 1-The robot move to the first point from the zero-position** with proper obstacle avoidance.
Image: point1 correctly reached. https://imgur.com/SDvIvX5
STEP 2-Then the robot comes back to zero-position ***by crashing into the obstacles.*** (I don't want this robot to come to zero-position. Bcs the next point is very close to it.)
crashing image: https://imgur.com/3O76uWf
zero postion: https://imgur.com/gCQXnTU
STEP 3-Then robot moves to the second point prescribed very nicely with proper obstacle avoidance.
STEPS 1 and STEP 3 are only desired. I dont want step 2. What is that i should do? I feel i have no more stones left unturned. Kindly help.
NB: **zero position is not set by me. It is the pose in which the CAD model was created.
I have also tried `setApproximateJointValueTarget()`. But results are the same as mentioned above.
I am using ros melodic and kinetic (issues exist on both)
I am a beginner .
↧