A couple of problems with Maxwell's Chess package

49 views
Skip to first unread message

Patrick Goebel

unread,
May 17, 2013, 12:38:14 PM5/17/13
to hbrob...@googlegroups.com
Hi Fergs,

I'm trying your Chess package using Maxwell in fake mode to see if I can move the gripper to a target pose,  and I've run into a couple of glitches.  To fire things up I run:

$ roslaunch maxwell_moveit_config demo_fake.launch

and everything comes up OK including RViz with Maxwell nicely displayed.

Then I run a simple test as follows:
  • move the arm to a starting joint configuration
  • store the gripper pose in this position
  • move the arm a little to a different joint configuration
  • then try to use moveToPose() to move the gripper to the saved pose

I'll list the relevant Python code I am using below.

The first problem was that I got the error:

MotionManager instance has no attribute 'listener'

So I changed line 261 in grasp_utilities.py from:

        pose_transformed = self.listener.transformPose(self._fixed_frame, pose_stamped)

to

        pose_transformed = self._listener.transformPose(self._fixed_frame, pose_stamped)

This fixed the above error.  Now my test script runs fine up to the point where it tries to run moveToPose() to get the gripper back to the saved pose.  At that point I get the error:

[ INFO] [1368808483.632983480]: Ready to take MoveGroup commands for group Arm.
Traceback (most recent call last):
  File "./maxwell.py", line 51, in <module>
    TestMoveIt()
  File "./maxwell.py", line 48, in __init__
    move.moveToPose(target_pose)
  File "/home/patrick/catkin_ws/src/chessbox/chess_player/src/chess_player/grasp_utilities.py", line 261, in moveToPose
    pose_transformed = self._listener.transformPose(self._fixed_frame, pose_stamped)
  File "/opt/ros/groovy/lib/python2.7/dist-packages/tf/listener.py", line 187, in transformPose
    mat44 = self.asMatrix(target_frame, ps.header)
  File "/opt/ros/groovy/lib/python2.7/dist-packages/tf/listener.py", line 74, in asMatrix
    translation,rotation = self.lookupTransform(target_frame, hdr.frame_id, hdr.stamp)
tf.ExtrapolationException: Lookup would require extrapolation into the future.  Requested time 1368808485.754877090 but the latest data is at time 1368808483.771286011, when looking up transform from frame [/odom] to frame [/base_link]

Here now is my test script:

#!/usr/bin/env python

import rospy
import roslib; roslib.load_manifest('rbx2_arm_navigation')

import actionlib

from tf.listener import *
from tf.transformations import euler_from_quaternion, quaternion_from_euler

from geometry_msgs.msg import PoseStamped, Pose, PoseArray

from moveit_commander import MoveGroupCommander
from chess_player.grasp_utilities import *

PLAN_ONLY = False

FIXED_FRAME = 'base_link'

class  TestMoveIt:
    def __init__(self):
        rospy.init_node("test_moveit")
       
        self.listener = TransformListener()
       
        # planning in joint space
        group = MoveGroupCommander("Arm")
       
        move = MotionManager('Arm', FIXED_FRAME, self.listener)           

        joint_positions = [0.5, 0.5, 0.5, 0.5, 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.5, 0.3, 0.1, 0.2, 0.2, 0.2, 0.5]
        group.plan(joint_positions)
        group.go()
       
        move.moveToPose(target_pose)

if __name__ == "__main__":
    TestMoveIt()
   

Alan Downing

unread,
May 17, 2013, 1:16:30 PM5/17/13
to hbrob...@googlegroups.com
For PR2Lite, I added the following line around transfromPose:

        now = rospy.Time.now()
        self.listener.waitForTransform("chess_board", "base_link", now, rospy.Duration(1.0))
        fr.header.stamp = now
        self.listener.mutex.acquire()
        fr_tfpose = self.listener.transformPose("base_link", fr)
        self.listener.mutex.release()

PR2Lite's move arm logic is pretty different from Maxwell's though.

Hope this helps,

Alan


--
You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+...@googlegroups.com.
To post to this group, send email to hbrob...@googlegroups.com.
Visit this group at http://groups.google.com/group/hbrobotics?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Michael Ferguson

unread,
May 17, 2013, 2:02:10 PM5/17/13
to hbrob...@googlegroups.com
Ah yes, that is a typo -- and that code has never run on my machine, because in the ChessExecutive, we pass in the global TransformListener so that there is only one instance shared among many classes (cuts down on memory overhead, since each Listener will have a cache).

You'll also want to add a small delay (say 2 seconds) after the creation of the listener (so that the cache gets filled in). You can do something more sophisticated with try/except, but right now the code doesn't really do that yet.

Finally, are you using my .rosinstall file? You'll notice I'm building moveit_core and moveit_ros from source, and using a revision about 1-2 releases old. There's currently something wonky going on in the latest release, which Ioan is aware of, but due to ICRA/ROScon, it hasn't been debugged and fixed.

-Fergs


On Fri, May 17, 2013 at 9:38 AM, Patrick Goebel <pat...@pirobot.org> wrote:

--

Patrick Goebel

unread,
May 17, 2013, 6:52:22 PM5/17/13
to hbrob...@googlegroups.com
Thanks Fergs and Alan D.,

Adding a delay did the trick. And no I'm not using your .rosinstall
file which might explain why my test doesn't move the gripper to exactly
the right location. But it's good enough for now since I'm just trying
to understand the MoveIt! basics at the moment.

Also, I have an open issue submitted with Ioan as well since the MoveIt!
set_target_pose() is not currently working...

--patrick

Michael Ferguson

unread,
May 17, 2013, 7:04:08 PM5/17/13
to hbrob...@googlegroups.com
So, I will just point out, that the "place" action appears to be broken in the latest moveIt, which is why I'm using the older version (it is broken on PR2 tutorial as well, something internal is not happy)

-Fergs


--
You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+unsubscribe@googlegroups.com.

Patrick Goebel

unread,
May 17, 2013, 7:23:38 PM5/17/13
to hbrob...@googlegroups.com
Ah, thanks for the heads up.

--p


On 05/17/2013 04:04 PM, Michael Ferguson wrote:
So, I will just point out, that the "place" action appears to be broken in the latest moveIt, which is why I'm using the older version (it is broken on PR2 tutorial as well, something internal is not happy)

-Fergs
On Fri, May 17, 2013 at 3:52 PM, Patrick Goebel <pat...@pirobot.org> wrote:
Thanks Fergs and Alan D.,

Adding a delay did the trick.  And no I'm not using your .rosinstall file which might explain why my test doesn't move the gripper to exactly the right location.  But it's good enough for now since I'm just trying to understand the MoveIt! basics at the moment.

Also, I have an open issue submitted with Ioan as well since the MoveIt! set_target_pose() is not currently working...

--patrick


On 05/17/2013 11:02 AM, Michael Ferguson wrote:
Ah yes, that is a typo -- and that code has never run on my machine, because in the ChessExecutive, we pass in the global TransformListener so that there is only one instance shared among many classes (cuts down on memory overhead, since each Listener will have a cache).

You'll also want to add a small delay (say 2 seconds) after the creation of the listener (so that the cache gets filled in). You can do something more sophisticated with try/except, but right now the code doesn't really do that yet.

Finally, are you using my .rosinstall file? You'll notice I'm building moveit_core and moveit_ros from source, and using a revision about 1-2 releases old. There's currently something wonky going on in the latest release, which Ioan is aware of, but due to ICRA/ROScon, it hasn't been debugged and fixed.

-Fergs


--
You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+...@googlegroups.com.

To post to this group, send email to hbrob...@googlegroups.com.
Visit this group at http://groups.google.com/group/hbrobotics?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages