The new location as of August 5th, 2016 is https://github.com/ros-planning/moveit
See migration notes for more details.
Please do not open new pull requests or issues in this old location.
THIS REPO HAS MOVED TO https://github.com/ros-planning/moveit
The new location as of August 5th, 2016 is https://github.com/ros-planning/moveit
See migration notes for more details.
Please do not open new pull requests or issues in this old location.
Hi,
Is there any possibility to add a Python interface for setting the max velocity scaling factor (known as setMaxVelocityScalingFactor in C++ api)?
Hi,
I've had issues in the past with moveit_commander when using arms with continuous ('infinite') revolute joints like the PR2
If such a joint is set a large value like 15.0 radians then it complains that the joint value target is out of bounds.
I've partially mended this situation by modifying move_group.py by normalizing all angles to be within the [-pi, pi] range. see my branch of moveit_commander here
Is there a better way to do this? (e.g. allow continuous joints to take on any values)
I have not found a way to set trajectory constraints as descrived in the moveit documentation using constraint msg objects. Only through a database, that I can't not figure out how to fill. Plus i have the requirement to manage some dimanimc constrains that change depending on the objective. I thing the key step here is to add more bindings to python interface defined in ros-planning/moveit_ros repo right?
The documentation comment for MoveGroupCommander.get_current_joint_values() states the following:
Get the current configuration of the group as a dictionary (these are values published on /joint_states)
However, get_current_joint_values() actually returns a list of the group's joint positions (a list of floats). Which is right, the comment, or the behavior?
I'm using the latest MoveIt! Debian packages under Ubuntu 12.04 and ROS Groovy. I have a 4 DoF arm (the original TurtleBot arm) and I have run the setup assistant successfully and can run the demo.launch file without trouble.
Now I am trying to make the set_pose_target() function work. My test scenario goes like this:
The first two plan() operations complete successfully but the final set_target_pose() command always fails with error "ABORTED: No motion plan found"
My Python code looks like this:
group = MoveGroupCommander("left_arm")
joint_positions = [-0.7, 0.5, 0.5, 0.5]
group.plan(joint_positions)
group.go()
ee_link = group.get_end_effector_link()
target_pose = group.get_current_pose(ee_link)
joint_positions = [-0.4, 0.7, 0.7, 0.9]
group.plan(joint_positions)
group.go()
group.set_pose_target(target_pose, ee_link)
group.go()
More details follow:
In case it matters, I am using Mike Ferguson's SimpleMoveItControllerManager plugin which he created for Maxwell and uses for his chess playing package that uses MoveIt! So my pi_robot_moveit_controller_manager.launch file looks like this:
<launch>
<arg name="moveit_controller_manager" default="simple_moveit_controller_manager/SimpleMoveItControllerManager" />
<param name="moveit_controller_manager" value="$(arg moveit_controller_manager)"/>
<!-- load controller_list -->
< rosparam file="$(find rbx2_moveit_pi_robot)/config/controllers.yaml"/>
</launch>
My kinematics.yaml file looks like this:
left_arm:
kinematics_solver: kdl_kinematics_plugin/KDLKinematicsPlugin
kinematics_solver_search_resolution: 0.005
kinematics_solver_timeout: 0.05
kinematics_solver_attempts: 3
and my controllers.yaml file looks like this:
controller_list:
- name: left_arm_controller
ns: follow_joint_trajectory
default: true
joints:
- left_arm_shoulder_pan_joint
- left_arm_shoulder_lift_joint
- left_arm_elbow_flex_joint
- left_arm_wrist_flex_joint
When running with debugging turned on in move_group.launch, the terminal output looks like this just before the failure:
[ INFO] [1368797588.723646659]: Planning request received for MoveGroup action. Forwarding to planning pipeline.
[New Thread 0xac4dab40 (LWP 20220)]
[ INFO] [1368797588.748130931]: No planner specified. Using default.
[ INFO] [1368797588.748421894]: Attempting to use default projection.
[ INFO] [1368797588.750997503]: Starting with 1 states
[Thread 0xac4dab40 (LWP 20220) exited]
[ INFO] [1368797588.859986226]: Created 179 (8 start + 171 goal) states in 156 cells (6 start (6 on boundary) + 150 goal (149 on boundary))
[ INFO] [1368797588.860084225]: Solution found in 0.111389 seconds
[ INFO] [1368797588.863540900]: Path simplification took 0.003263 seconds
[ INFO] [1368797588.887944698]: Combined planning and execution request received for MoveGroup action. Forwarding to planning and execution pipeline.
[ INFO] [1368797588.888157335]: Planning attempt 1 of at most 1
[New Thread 0xac4dab40 (LWP 20221)]
[ INFO] [1368797588.896059972]: No planner specified. Using default.
[ INFO] [1368797588.896163651]: Attempting to use default projection.
[ INFO] [1368797588.898420936]: Starting with 1 states
[Thread 0xac4dab40 (LWP 20221) exited]
[ INFO] [1368797589.085509373]: Created 99 (8 start + 91 goal) states in 88 cells (7 start (7 on boundary) + 81 goal (81 on boundary))
[ INFO] [1368797589.085635764]: Solution found in 0.189221 seconds
[ INFO] [1368797589.089453077]: Path simplification took 0.003663 seconds
[New Thread 0xac4dab40 (LWP 20222)]
[New Thread 0xabcd9b40 (LWP 20223)]
[ INFO] [1368797589.113028758]: new trajectory to left_arm_controller
[INFO] [WallTime: 1368797589.114585] left_arm_controller: Action goal recieved.
[INFO] [WallTime: 1368797589.115193] Executing trajectory
[INFO] [WallTime: 1368797591.016754] left_arm_controller: Done.
[Thread 0xabcd9b40 (LWP 20223) exited]
[Thread 0xac4dab40 (LWP 20222) exited]
[ INFO] [1368797591.422767618]: Planning request received for MoveGroup action. Forwarding to planning pipeline.
[New Thread 0xac4dab40 (LWP 20226)]
[ INFO] [1368797591.444283426]: Starting with 1 states
[Thread 0xac4dab40 (LWP 20226) exited]
[ INFO] [1368797591.598512890]: Created 74 (39 start + 35 goal) states in 61 cells (35 start (35 on boundary) + 26 goal (26 on boundary))
[ INFO] [1368797591.598600198]: Solution found in 0.158409 seconds
[ INFO] [1368797591.602076584]: Path simplification took 0.003353 seconds
[ INFO] [1368797591.623808809]: Combined planning and execution request received for MoveGroup action. Forwarding to planning and execution pipeline.
[ INFO] [1368797591.623984019]: Planning attempt 1 of at most 1
[New Thread 0xac4dab40 (LWP 20228)]
[ INFO] [1368797591.640592750]: Starting with 1 states
[Thread 0xac4dab40 (LWP 20228) exited]
[ INFO] [1368797591.762340384]: Created 35 (18 start + 17 goal) states in 25 cells (16 start (16 on boundary) + 9 goal (8 on boundary))
[ INFO] [1368797591.762434002]: Solution found in 0.123763 seconds
[ INFO] [1368797591.766194565]: Path simplification took 0.003636 seconds
[New Thread 0xac4dab40 (LWP 20229)]
[New Thread 0xabcd9b40 (LWP 20230)]
[ INFO] [1368797591.788123164]: new trajectory to left_arm_controller
[INFO] [WallTime: 1368797591.821393] left_arm_controller: Action goal recieved.
[INFO] [WallTime: 1368797591.822459] Executing trajectory
[INFO] [WallTime: 1368797593.305062] left_arm_controller: Done.
[Thread 0xabcd9b40 (LWP 20230) exited]
[Thread 0xac4dab40 (LWP 20229) exited]
[ INFO] [1368797593.389761637]: Combined planning and execution request received for MoveGroup action. Forwarding to planning and execution pipeline.
[ INFO] [1368797593.390008004]: Planning attempt 1 of at most 1
[New Thread 0xac4dab40 (LWP 20231)]
[ INFO] [1368797593.401752802]: Starting with 1 states
[ERROR] [1368797598.404696568]: Unable to sample any valid states for goal tree
[ INFO] [1368797598.404778584]: Created 1 (1 start + 0 goal) states in 1 cells (1 start (1 on boundary) + 0 goal (0 on boundary))
[ INFO] [1368797598.404831927]: No solution found after 5.005785 seconds
[Thread 0xac4dab40 (LWP 20231) exited]
[ INFO] [1368797598.472548311]: Unable to solve the planning problem
[New Thread 0xac4dab40 (LWP 20233)]
The missing methods are:
And I also added the new ones added on PR ros-planning/moveit_ros#641
Still missing are:
I'll try to implement them when I get some extra time
I am trying to follow the python tutorial, but this simple file already crashes:
#!/usr/bin/python
import sys
import copy
import rospy
import moveit_commander
import moveit_msgs.msg
import geometry_msgs.msg
print "============ Starting tutorial setup"
moveit_commander.roscpp_initialize(sys.argv)
rospy.init_node('move_group_python_interface_tutorial',
anonymous=True)
robot = moveit_commander.RobotCommander()
And the result in a segmentation fault.
Here is a backtrace: http://pastebin.com/3bftAaaj
I am trying to get MoveIt to work with Amigo (https://github.com/tue-robotics/amigo_moveit_config). But I get the same error if I only have a roscore running. (No parameters loaded).
The MoveGroup method setStartState is not exposed by the MoveGroupCommander, is it intentional?
Will there be a feature to update the query start/goal state in rViz through the python moveit_commander?
I would like to reanimate the investigations about the GIL following this thread and the suggestion of Wouter: https://groups.google.com/d/topic/moveit-users/juXENC4XoRo/discussion
It looks like all threads are stopped, avoiding tf.TransformListener to be up to date and also avoiding subscribers to receive new messages since they are all threaded in Python.
It looks a major issue to me, forcing the user to rospy.sleep() after each call to MoveGroup to let threads getting new updates before continuing execution.
Installing from debs, my moveit_commander_cmdline.py is in /opt/ros/hydro/lib/moveit_commander/, not /opt/ros/hydro/lib/python2.7/dist-packages with the rest of the scripts.
As a result, rosrun moveit_commander moveit_commander_cmdline.py doesn't work.
When defining a post_target, it will be great if one can set the Position and Orientation tolerances separately.
Both the C++ and Rviz interfaces support setting the number of planning attempts. The planning attempts are computed in parallel and the best one is used. This is an extremely useful feature that is missing from the python api.
hi,
im using ubuntu 14.04 on ROS-indigo. i tried to run this code:
> #!/usr/bin/env python
> import sys
> import copy
> import rospy
> import moveit_commander
> import moveit_msgs.msg
>
but then i got the following error:
> anthonio@PC190:~/kuka_bot$ rosrun agilus testing.py
> terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >'
> what(): boost: mutex lock failed in pthread_mutex_lock: Invalid argument
> Aborted (core dumped)
>
can someone please help me?
To Whom It May Concern,
I use the following code, based on R. Patrick Goebel moveit_cartesian_demo.py, https://github.com/pirobot/rbx2/blob/indigo-devel/rbx2_arm_nav/scripts/moveit_cartesian_demo.py, to compute a cartesian path between a start_pose and a target_pose. While a path is generated, it fails to execute due to empty velocity and acceleration vectors being sent to ThomasTimm's ur5 driver, https://github.com/ThomasTimm/ur_modern_driver (@ThomasTimm). I found a solution to this issue in C++ here, https://groups.google.com/forum/#!topic/moveit-users/x5FwalM5ruk and https://groups.google.com/forum/#!topic/moveit-users/MOoFxy2exT4, but have been unable to find a similar workaround for moveit_commander. Any help you can provide would be greatly appreciated.
# Set the target pose
for corner_pose in corner_locations.poses[1:]:
#Move the end effecor to the x - .45, y, z positon
#Set the target pose to the hole location in the base_link frame
target_pose = Pose()
target_pose.position.x = corner_pose.position.x - 0.075
target_pose.position.y = corner_pose.position.y
target_pose.position.z = corner_pose.position.z
target_pose.orientation.x = corner_pose.orientation.x
target_pose.orientation.y = corner_pose.orientation.y
target_pose.orientation.z = corner_pose.orientation.z
target_pose.orientation.w = corner_pose.orientation.w
fraction = 0.0
attempts = 0
start_pose = self.arm.get_current_pose(end_effector_link).pose
# Set the start state to the current state
self.arm.set_start_state_to_current_state()
# Plan the Cartesian path connecting the start point and goal
while fraction < 1.0 and attempts < 100:
(plan, fraction) = self.arm.compute_cartesian_path([start_pose, target_pose], # waypoint poses
0.01, # eef_step
0.0, # jump_threshold
True) # avoid_collisions
# Increment the number of attempts
attempts += 1
# If we have a complete plan, return that plan
if fraction == 1.0:
self.arm.execute(plan)
rospy.loginfo("Successfully sealed section " + str(location))
location += 1
else:
rospy.loginfo("Unable to seal section " + str(location))
location += 1
continue
Thank you for your time and attention to this matter. Have a great week. God bless.
Very Respectfully,
CMobley7
I've complied moveit on Jade on vivid 15.04, which has installed moveit_commander
into /usr/local/lib/python2.7/dist-packages
which is where I would expect it. However all the other built modules remain in /moveit/devel/lib/python2.7/dist-packages
. Should the install put them into the same dir as moveit_commander (as it has dependencies on moveit_ros_planning_interface) or is it more usual to add the /devel path to your python sys.path. I was kinda expecting that as built modules they would go into the same dir as moveit_commander..
When running a pick-and-place Python script that works fine using the latest MoveIt Debian packages and ROS Hydro (Ubuntu 12.04), I get the following error when running the same script when using the source version of moveit_commander, moveit_ros and moveit_core:
Traceback (most recent call last):
File "/home/patrick/catkin_ws/src/rbx2/rbx2_arm_nav/scripts/moveit_pick_and_place_demo.py", line 440, in <module>
MoveItDemo()
File "/home/patrick/catkin_ws/src/rbx2/rbx2_arm_nav/scripts/moveit_pick_and_place_demo.py", line 217, in __init__
success = right_arm.pick(target_id, grasps)
File "/home/patrick/catkin_ws/src/moveit_commander/src/moveit_commander/move_group.py", line 455, in pick
return self._g.pick(object_name, [conversions.msg_to_string(x) for x in grasp])
TypeError: No to_python (by-value) converter found for C++ type: moveit::planning_interface::MoveItErrorCode
python: /usr/include/boost/thread/pthread/pthread_mutex_scoped_lock.hpp:26: boost::pthread::pthread_mutex_scoped_lock::pthread_mutex_scoped_lock(pthread_mutex_t*): Assertion `!pthread_mutex_lock(m)' failed.
Aborted (core dumped)
My test script is included below:
#!/usr/bin/env python
import rospy, sys
import moveit_commander
from geometry_msgs.msg import PoseStamped, Pose
from moveit_commander import MoveGroupCommander, PlanningSceneInterface
from moveit_msgs.msg import PlanningScene, ObjectColor
from moveit_msgs.msg import Grasp, GripperTranslation
from trajectory_msgs.msg import JointTrajectory, JointTrajectoryPoint
from tf.transformations import quaternion_from_euler
from copy import deepcopy
GROUP_NAME_ARM = 'right_arm'
GROUP_NAME_GRIPPER = 'right_gripper'
GRIPPER_FRAME = 'right_gripper_link'
GRIPPER_OPEN = [0.03]
GRIPPER_CLOSED = [-0.02]
GRIPPER_NEUTRAL = [0.01]
GRIPPER_JOINT_NAMES = ['right_gripper_finger_joint']
GRIPPER_EFFORT = [1.0]
REFERENCE_FRAME = 'base_footprint'
class MoveItDemo:
def __init__(self):
# Initialize the move_group API
moveit_commander.roscpp_initialize(sys.argv)
rospy.init_node('moveit_demo')
# Use the planning scene object to add or remove objects
scene = PlanningSceneInterface()
# Create a scene publisher to push changes to the scene
self.scene_pub = rospy.Publisher('planning_scene', PlanningScene)
# Create a publisher for displaying gripper poses
self.gripper_pose_pub = rospy.Publisher('gripper_pose', PoseStamped)
# Create a dictionary to hold object colors
self.colors = dict()
# Initialize the MoveIt! commander for the arm
right_arm = MoveGroupCommander(GROUP_NAME_ARM)
# Initialize the MoveIt! commander for the gripper
right_gripper = MoveGroupCommander(GROUP_NAME_GRIPPER)
# Get the name of the end-effector link
end_effector_link = right_arm.get_end_effector_link()
# Allow some leeway in position (meters) and orientation (radians)
right_arm.set_goal_position_tolerance(0.05)
right_arm.set_goal_orientation_tolerance(0.1)
# Allow replanning to increase the odds of a solution
right_arm.allow_replanning(True)
# Set the right arm reference frame
right_arm.set_pose_reference_frame(REFERENCE_FRAME)
# Allow 5 seconds per planning attempt
right_arm.set_planning_time(5)
# Set a limit on the number of pick attempts before bailing
max_pick_attempts = 5
# Set a limit on the number of place attempts
max_place_attempts = 5
# Give the scene a chance to catch up
rospy.sleep(2)
# Give each of the scene objects a unique name
table_id = 'table'
box1_id = 'box1'
box2_id = 'box2'
target_id = 'target'
# Remove leftover objects from a previous run
scene.remove_world_object(table_id)
scene.remove_world_object(box1_id)
scene.remove_world_object(box2_id)
scene.remove_world_object(target_id)
# Remove any attached objects from a previous session
scene.remove_attached_object(GRIPPER_FRAME, target_id)
# Give the scene a chance to catch up
rospy.sleep(1)
# Start the arm in the "resting" pose stored in the SRDF file
right_arm.set_named_target('resting')
right_arm.go()
# Open the gripper to the neutral position
right_gripper.set_joint_value_target(GRIPPER_NEUTRAL)
right_gripper.go()
rospy.sleep(1)
# Set the height of the table off the ground
table_ground = 0.75
# Set the dimensions of the scene objects [l, w, h]
table_size = [0.2, 0.7, 0.01]
box1_size = [0.1, 0.05, 0.05]
box2_size = [0.05, 0.05, 0.15]
# Set the target size [l, w, h]
target_size = [0.02, 0.01, 0.12]
# Add a table top and two boxes to the scene
table_pose = PoseStamped()
table_pose.header.frame_id = REFERENCE_FRAME
table_pose.pose.position.x = 0.25
table_pose.pose.position.y = 0.0
table_pose.pose.position.z = table_ground + table_size[2] / 2.0
table_pose.pose.orientation.w = 1.0
scene.add_box(table_id, table_pose, table_size)
box1_pose = PoseStamped()
box1_pose.header.frame_id = REFERENCE_FRAME
box1_pose.pose.position.x = 0.21
box1_pose.pose.position.y = -0.1
box1_pose.pose.position.z = table_ground + table_size[2] + box1_size[2] / 2.0
box1_pose.pose.orientation.w = 1.0
scene.add_box(box1_id, box1_pose, box1_size)
box2_pose = PoseStamped()
box2_pose.header.frame_id = REFERENCE_FRAME
box2_pose.pose.position.x = 0.19
box2_pose.pose.position.y = 0.13
box2_pose.pose.position.z = table_ground + table_size[2] + box2_size[2] / 2.0
box2_pose.pose.orientation.w = 1.0
scene.add_box(box2_id, box2_pose, box2_size)
# Set the target pose in between the boxes and on the table
target_pose = PoseStamped()
target_pose.header.frame_id = REFERENCE_FRAME
target_pose.pose.position.x = 0.22
target_pose.pose.position.y = 0.0
target_pose.pose.position.z = table_ground + table_size[2] + target_size[2] / 2.0
target_pose.pose.orientation.w = 1.0
# Add the target object to the scene
scene.add_box(target_id, target_pose, target_size)
# Make the table red and the boxes orange
self.setColor(table_id, 0.8, 0, 0, 1.0)
self.setColor(box1_id, 0.8, 0.4, 0, 1.0)
self.setColor(box2_id, 0.8, 0.4, 0, 1.0)
# Make the target yellow
self.setColor(target_id, 0.9, 0.9, 0, 1.0)
# Send the colors to the planning scene
self.sendColors()
# Set the support surface name to the table object
#right_arm.set_support_surface_name(table_id)
# Specify a pose to place the target after being picked up
place_pose = PoseStamped()
place_pose.header.frame_id = REFERENCE_FRAME
place_pose.pose.position.x = 0.18
place_pose.pose.position.y = -0.18
place_pose.pose.position.z = table_ground + table_size[2] + target_size[2] / 2.0
place_pose.pose.orientation.w = 1.0
# Initialize the grasp pose to the target pose
grasp_pose = target_pose
# Shift the grasp pose by half the width of the target to center it
grasp_pose.pose.position.y -= target_size[1] / 2.0
# Generate a list of grasps
grasps = self.make_grasps(grasp_pose, [target_id])
# Publish the grasp poses so they can be viewed in RViz
for grasp in grasps:
self.gripper_pose_pub.publish(grasp.grasp_pose)
rospy.sleep(0.2)
# Track success/failure and number of attempts for pick operation
success = False
n_attempts = 0
# Repeat until we succeed or run out of attempts
while success == False and n_attempts < max_pick_attempts:
success = right_arm.pick(target_id, grasps)
n_attempts += 1
rospy.loginfo("Pick attempt: " + str(n_attempts))
rospy.sleep(0.2)
# If the pick was successful, attempt the place operation
if success:
success = False
n_attempts = 0
# Generate valid place poses
places = self.make_places(place_pose)
# Repeat until we succeed or run out of attempts
while success == False and n_attempts < max_place_attempts:
for place in places:
success = right_arm.place(target_id, place)
if success:
break
n_attempts += 1
rospy.loginfo("Place attempt: " + str(n_attempts))
rospy.sleep(0.2)
if not success:
rospy.loginfo("Place operation failed after " + str(n_attempts) + " attempts.")
else:
rospy.loginfo("Pick operation failed after " + str(n_attempts) + " attempts.")
# Return the arm to the "resting" pose stored in the SRDF file
right_arm.set_named_target('resting')
right_arm.go()
# Open the gripper to the neutral position
right_gripper.set_joint_value_target(GRIPPER_NEUTRAL)
right_gripper.go()
rospy.sleep(1)
# Shut down MoveIt cleanly
moveit_commander.roscpp_shutdown()
# Exit the script
moveit_commander.os._exit(0)
# Get the gripper posture as a JointTrajectory
def make_gripper_posture(self, joint_positions):
# Initialize the joint trajectory for the gripper joints
t = JointTrajectory()
# Set the joint names to the gripper joint names
t.joint_names = GRIPPER_JOINT_NAMES
# Initialize a joint trajectory point to represent the goal
tp = JointTrajectoryPoint()
# Assign the trajectory joint positions to the input positions
tp.positions = joint_positions
# Set the gripper effort
tp.effort = GRIPPER_EFFORT
tp.time_from_start = rospy.Duration(1.0)
# Append the goal point to the trajectory points
t.points.append(tp)
return t
# Generate a gripper translation in the direction given by vector
def make_gripper_translation(self, min_dist, desired, vector):
# Initialize the gripper translation object
g = GripperTranslation()
# Set the direction vector components to the input
g.direction.vector.x = vector[0]
g.direction.vector.y = vector[1]
g.direction.vector.z = vector[2]
# The vector is relative to the gripper frame
g.direction.header.frame_id = GRIPPER_FRAME
# Assign the min and desired distances from the input
g.min_distance = min_dist
g.desired_distance = desired
return g
# Generate a list of possible grasps
def make_grasps(self, initial_pose_stamped, allowed_touch_objects):
# Initialize the grasp object
g = Grasp()
# Set the pre-grasp and grasp postures appropriately
g.pre_grasp_posture = self.make_gripper_posture(GRIPPER_OPEN)
g.grasp_posture = self.make_gripper_posture(GRIPPER_CLOSED)
# Set the approach and retreat parameters as desired
g.pre_grasp_approach = self.make_gripper_translation(0.01, 0.1, [1.0, 0.0, 0.0])
g.post_grasp_retreat = self.make_gripper_translation(0.1, 0.15, [0.0, -1.0, 1.0])
# Set the first grasp pose to the input pose
g.grasp_pose = initial_pose_stamped
# Pitch angles to try
pitch_vals = [0, 0.1, -0.1, 0.2, -0.2, 0.4, -0.4]
# Yaw angles to try
yaw_vals = [0]
# A list to hold the grasps
grasps = []
# Generate a grasp for each pitch and yaw angle
for y in yaw_vals:
for p in pitch_vals:
# Create a quaternion from the Euler angles
q = quaternion_from_euler(0, p, y)
# Set the grasp pose orientation accordingly
g.grasp_pose.pose.orientation.x = q[0]
g.grasp_pose.pose.orientation.y = q[1]
g.grasp_pose.pose.orientation.z = q[2]
g.grasp_pose.pose.orientation.w = q[3]
# Set and id for this grasp (simply needs to be unique)
g.id = str(len(grasps))
# Set the allowed touch objects to the input list
g.allowed_touch_objects = allowed_touch_objects
# Don't restrict contact force
g.max_contact_force = 0
# Degrade grasp quality for increasing pitch angles
g.grasp_quality = 1.0 - abs(p)
# Append the grasp to the list
grasps.append(deepcopy(g))
# Return the list
return grasps
# Generate a list of possible place poses
def make_places(self, init_pose):
# Initialize the place location as a PoseStamped message
place = PoseStamped()
# Start with the input place pose
place = init_pose
# A list of x shifts (meters) to try
x_vals = [0, 0.005, 0.01, 0.015, -0.005, -0.01, -0.015]
# A list of y shifts (meters) to try
y_vals = [0, 0.005, 0.01, 0.015, -0.005, -0.01, -0.015]
# A list of pitch angles to try
#pitch_vals = [0, 0.005, -0.005, 0.01, -0.01, 0.02, -0.02]
pitch_vals = [0]
# A list of yaw angles to try
yaw_vals = [0]
# A list to hold the places
places = []
# Generate a place pose for each angle and translation
for y in yaw_vals:
for p in pitch_vals:
for y in y_vals:
for x in x_vals:
place.pose.position.x = init_pose.pose.position.x + x
place.pose.position.y = init_pose.pose.position.y + y
# Create a quaternion from the Euler angles
q = quaternion_from_euler(0, p, y)
# Set the place pose orientation accordingly
place.pose.orientation.x = q[0]
place.pose.orientation.y = q[1]
place.pose.orientation.z = q[2]
place.pose.orientation.w = q[3]
# Append this place pose to the list
places.append(deepcopy(place))
# Return the list
return places
# Set the color of an object
def setColor(self, name, r, g, b, a = 0.9):
# Initialize a MoveIt color object
color = ObjectColor()
# Set the id to the name given as an argument
color.id = name
# Set the rgb and alpha values given as input
color.color.r = r
color.color.g = g
color.color.b = b
color.color.a = a
# Update the global color dictionary
self.colors[name] = color
# Actually send the colors to MoveIt!
def sendColors(self):
# Initialize a planning scene object
p = PlanningScene()
# Need to publish a planning scene diff
p.is_diff = True
# Append the colors from the global color dictionary
for color in self.colors.values():
p.object_colors.append(color)
# Publish the scene diff
self.scene_pub.publish(p)
if __name__ == "__main__":
MoveItDemo()
Many places in interpreter.py use code like float(str)
to parse a string into a floating point value. Unfortunately Python does not default to using locale-specific float parsing, so in places where "," (comma) is used for the decimal, this fails.
The correct thing is to use locale.atof(str)
instead, along with
import locale
locale.setlocale(locale.LC_ALL, '')
at the beginning.
Source: http://docs.python.org/2/library/locale.html#locale.atof
I am using the Python moveit_commander API (ROS Hydro Debian install and Ubuntu 12.04). My scripts run fine but they always exit with the following core dump message:
python: /usr/include/boost/thread/pthread/pthread_mutex_scoped_lock.hpp:26: boost::pthread::pthread_mutex_scoped_lock::pthread_mutex_scoped_lock(pthread_mutex_t*): Assertion `!pthread_mutex_lock(m)' failed.
Aborted (core dumped)
Is this something I should worry about?
I have pick and place working fairly well using the Python API. However, occasionally (but not all the time) the place operation fails because of a collision detected between the object being moved and the support surface (a table in my case). The specific messages are:
[ INFO] [1394932684.299889807]: IK failed
[ INFO] [1394932684.302000435]: Found a contact between 'table' (type 'Object') and 'target' (type 'Robot attached'), which constitutes a collision. Contact information is not stored.
[ INFO] [1394932684.302107838]: Collision checking is considered complete (collision was found and 0 contacts are stored)
I've checked fairly carefully through the Python API docs and the source code and there doesn't appear to be the equivalent of the C++ function group.setSupportSurfaceName() or the equivalent of the Python function grasp.allowed_touch_objects() that can be used with the pick operation. Did I miss something or is there another way to tell MoveIt that the object being moved is allowed to touch the support surface?
As moveit_msgs have update and the commander connects to an action client using these messages, a user may get:
[ERROR] [1468834515.942496322, 397.185000000]: Client [/move_group] wants topic /move_group/goal to have datatype/md5sum [moveit_msgs/MoveGroupActionGoal/af242119c3633849fe07bc300952a4c0], but our version has [moveit_msgs/MoveGroupActionGoal/df11ac1a643d87b6e6a6fe5af1823709]. Dropping connection
AFAIK, this only happens under Ubuntu 11.10 (Oneric) and ROS Groovy (Debian install).
When attempting to run moveit_commander_cmdline.py, I get the following fatal error:
Traceback (most recent call last):
File "/opt/ros/groovy/bin/moveit_commander_cmdline.py", line 11, in
from moveit_commander import MoveGroupCommandInterpreter, MoveGroupInfoLevel, roscpp_initialize, roscpp_shutdown
File "/opt/ros/groovy/lib/python2.7/dist-packages/moveit_commander/init.py", line 3, in
from planning_scene_interface import *
File "/opt/ros/groovy/lib/python2.7/dist-packages/moveit_commander/planning_scene_interface.py", line 40, in
from pyassimp import pyassimp
ImportError: cannot import name pyassimp
The error can be fixed by replacing the line:
from pyassimp import pyassimp
with
from pyassimp import *
in /opt/ros/groovy/lib/python2.7/dist-packages/moveit_commander/planning_scene_interface.py", line 40
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.