Ask Your Question
1

Create a subscriber in Move Group Python Interface to keep getting desired poses to plan and execute

asked 2019-01-17 18:42:15 -0500

stevensu1838 gravatar image

updated 2019-01-18 01:50:51 -0500

My purpose: In the Move Group Python Interface section in the Moveit it tutorials(kinetic version), it shows we can plan a motion for a move group to a desired pose for the end-effector and excute it as shown is the snippet of code below: pose_goal = geometry_msgs.msg.Pose() pose_goal.orientation.w = 1.0 pose_goal.position.x = 0.4 pose_goal.position.y = 0.1 pose_goal.position.z = 0.4 group.set_pose_target(pose_goal)

In this example code available on moveit site, however, we can only plan one pose (instead of a number of successive poses which can form a smooth line) at a time. So I've got an idea that I could augmented this piece of code with a subscriber which listens to a ROS sensor sending poses to move group in this code then plan and execute those desired pose. Ideally, in this way, I can perform a smooth trajectory with all the poses together.

My first question is whether what I am planning to do feasible and practical?

If so, I've got some other questions while working on it. I am using a leap motion sensor as a publisher (publishing hand positions) in the ROS structure. As I said I would build a subscriber in the Move Group Python Interface code to keep receiving new poses then plan and execute in time. To get the job done: First,I created a package named leap_moveit with the following depedencies: catkin_create_pkg leap_moveit rospy rospack moveit_commander moveit_msgs geometry_msgs

Secondly,I put the modified Move Group Python Interface code(the main difference is there is a subscriber to obtain new desired poses in this code). The subscriber is: leap_sub = rospy.Subscriber('leapmotion/data', leapros, go_to_joint_state)

Thirdly,I updated CMakeLists.txt and package.xml accordingly and created a launch file in the launch directory of my leap_moveit pkg.

Finally, when I run roslaunch leap_moveit leapmoveit.launch to try out the code, I throws the following errors. Can anyone help?

mario@mario:~$ roslaunch leap_moveit leapmoveit.launch
... logging to /home/mario/.ros/log/fa712ea8-1ab7-11e9-a98a-94c6911255ab/roslaunch-mario-30026.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
WARNING: disk usage in log directory [/home/mario/.ros/log] is over 1GB.
It's recommended that you use the 'rosclean' command.

started roslaunch server http://localhost:32869/

SUMMARY
========

PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.14

NODES
  /
    leapmoveit_node (leap_moveit/move_group_python_interface_leap.py)

auto-starting new master
process[master]: started with pid [30043]
    ROS_MASTER_URI=http://localhost:11311

setting /run_id to fa712ea8-1ab7-11e9-a98a-94c6911255ab
process[rosout-1]: started with pid [30063]
started core service [/rosout]
process[leapmoveit_node-2]: started with pid [30069]
Failed to import pyassimp, see https://github.com/ros-planning/moveit/issues/86 for more info
[ERROR] [1547771310.996982652]: Robot model parameter not found! Did you remap 'robot_description'?
Traceback (most recent call last):
      File "/home/mario/catkin_ws/src/leap_moveit/src/move_

group_python_interface_leap.py", line 223, in <module>
    main()
  File "/home/mario/catkin_ws/src/leap_moveit/src/move_group_python_interface_leap.py", line 202, in main
    tutorial = MoveGroupPythonIntefaceTutorial()
  File "/home/mario/catkin_ws/src/leap_moveit/src/move_group_python_interface_leap ...
(more)
edit retag flag offensive close merge delete

Comments

Can you please update your question with all of the comments removed? Your code is unnecessarily long with them in and difficult to read

jayess gravatar imagejayess ( 2019-01-17 18:46:23 -0500 )edit

Hi buddy, updated. Basically, what I've done is I added a subscriber in the Move Group Python Interface example code.

stevensu1838 gravatar imagestevensu1838 ( 2019-01-18 01:54:32 -0500 )edit

But it doesn't work as expected. Is my idea of creating a subscriber wrong? Can you do me a favour?

stevensu1838 gravatar imagestevensu1838 ( 2019-01-18 01:56:13 -0500 )edit

hi did yo succeed in Create a subscriber and executing a continuous path?

vk gravatar imagevk ( 2019-07-14 17:00:28 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2019-01-18 04:09:43 -0500

updated 2019-01-18 08:15:15 -0500

Just to clarify are you trying to build a visual servoing system?

You mentioned that you want to joint several trajectories together into a single smooth movement. The main challenge with this is that as standard MoveiIt will project trajectories who's start and end velocities are zero, this mean that if you join them together the motion will 'stutter' as the arm stops and starts between trajectories.

This is a complex problem and there are a few different solutions out there. One is known as velocity control, here instead of planning paths a control law is defined which sets the 6 DOF velocity of the end effector based upon the location of the target. When an appropriate control law is set this will result in very smooth following of a moving target, however singularity avoidance is not as easy as it when using pre-planned trajectories.

Another option would be to plan each new trajectory from the current robot state including its position and velocity. This way each new plan knows the robot is in motion and will plan a trajectory which smoothly joins onto this motion. I personally don't know how to do this with MoveiIt, although I've love to find out if it's possible.

Regarding your specific question here, it appears to be a launch file problem. The MoveGroup by default tries to load a robot model (URDF) from a parameter called robot_description this parameter doesn't appear to be set. You'll also need other nodes (real or simulation) that can provide JointState messages and provide a trajectory action server.

Hope this helps.

Update:

You can use the jog_arm package to velocity control a robot, this package allows you to set the 6DOF velocity of the end effector as well as gracefully handling singularities for you (saves you a lot of headaches!)

You second question is a good one. It all comes down to the design of your control law, this function will take in target positions and produce desired EE velocities. Ideally as the EE gets close the target the velocities will reduce so it gradually slows down and comes to rest at the target. It's easy to overshoot if your controller is under-damped or not quite reach the target if it's over-damped. But you'll need to experiment with the real robot hardware to tune this correctly. You'll want this control loop running at least 10 times per second in my experience.

edit flag offensive delete link more

Comments

Hey buddy, thanks a million for your reply. I am very keen to know more about the velocity control method you mentioned above. Do you know where I can find more instructions about it? I am very interested in setting the 6 DOF velocity of the end effector based upon the location of the target.

stevensu1838 gravatar imagestevensu1838 ( 2019-01-18 04:42:38 -0500 )edit

But one more question is if we only set the velocity of the end effector, How can we can control the trajectory precisely? like if I move my target 5 cm, how can I ensure the end effector moves 5 cm too? Thx

stevensu1838 gravatar imagestevensu1838 ( 2019-01-18 04:46:10 -0500 )edit

I've added answers to your questions now.

PeteBlackerThe3rd gravatar imagePeteBlackerThe3rd ( 2019-01-18 06:28:36 -0500 )edit

You can use the jog_arm package to velocity control a robot setup with MoveIt,

I'm not sure that is what jog_arm does: jog_arm allows you to jog (ie: manually control) a robot and works best with a velocity control interface. It has no direct relation with MoveIt, nor does it use ..

gvdhoorn gravatar imagegvdhoorn ( 2019-01-18 06:41:32 -0500 )edit

.. any part of the MoveIt infrastructure to communicate with robots (or to be more precise: their drivers).

There is support for joint position controlled robots, but it's going to be sub-optimal at best.

gvdhoorn gravatar imagegvdhoorn ( 2019-01-18 06:43:29 -0500 )edit

My mistake. I've updated this now.

PeteBlackerThe3rd gravatar imagePeteBlackerThe3rd ( 2019-01-18 08:15:44 -0500 )edit

Hi, I've looked at the jog arm pkg and I found a not well explained pkg call jog api there. Since you both are ROS experts, can any of you tell me how to use this jog api pkg?

stevensu1838 gravatar imagestevensu1838 ( 2019-01-25 02:45:50 -0500 )edit

I've asked the creator of that pkg. He said I look use it to do what I want. But did say how to use his package. Can you give me a hand?

stevensu1838 gravatar imagestevensu1838 ( 2019-01-25 02:47:10 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2019-01-17 18:42:15 -0500

Seen: 245 times

Last updated: Jan 18