Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Move*_Test sets robot to PoseHome?

Hi there,

I'm trying to safely move an ABB robot arm to various targets using the python API. Before every movement, I test whether or not the target is in reach and does not cause collisions by running the Move*_Test method first. 

So far I've managed to find out that if there is a collision, the robot joints will be set to the position in which collision was detected. This was not necessarily what I had expected, but I can see why this would be useful.

However, if no collision is detected, and I send the Move* command for the same target, the movement of the robot seems to start from the robots Home Pose.

Of course I can simply save the robots joint positions before running the Move*_Test method and reset them afterwards, but I don't see anything like this happening in the examples. Which makes me wonder if I'm doing something wrong.

I'm doing the following:
   def move_to_pose(self, pose, frame="ROBOT_BASE_FRAME"):
       Moves the robot arm to a specified pose (px, py, pz, rx, ry, rz).
       The move is only executed if it can be done without causing collisions.

       pose : list(float,) or tuple(float,)
           List or tuple of floats representing the position and rotation of
           the target pose.
       frame : str, optional
           Reference frame with respect to which the pose should be placed.
           Default is 'ROBOT_BASE_FRAME'.

       moved : bool
           Whether the arm was succesfuly moved to the specified pose.
       # Convert pose from degrees to radians
       pose = [p if i < 3 else math.radians(p) for i, p in enumerate(pose)]
       # Add a new target to RoboDK relative to frame.
       target = self.RDK.AddTarget('TARGET', self.RDK.Item(frame, ITEM_TYPE_FRAME), self.robot)
       # Ensure that target is stable with respect to robot base frame.
       if frame != 'ROBOT_BASE_FRAME':
       # Wait for user to validate target
       input('Target created, press enter to continue...')
       # Convert pose to joint instructions.
       joints = self.robot.SolveIK(target.Pose(),
       # Remove target from RoboDK.
       # Execute movement.
       return self.move_to_joints(joints.list())

   def move_to_joints(self, joints):
       Moves the robot arm to specified joint positions.
       The move is only executed if it can be done without causing collisions.

       joints : list(float,)
           List of floats representing the target positions of the robots joints.

       moved : bool
           Whether the arm was succesfully moved to the specified pose.
       current = self.robot.Joints()
       # Check if movement causes any collisions.
       if len(joints) != len(current.list()) or self.robot.MoveJ_Test(current, joints, 1) > 0:
           print('Robot cannot reach target because it is out of reach or causes collision.')
           return False
       # Execute movement
       return True

Is there a way to test the feasibility of movement without it changing the robots position?

Thanks in advance!

With kind regards,

Very interested in this as well!
Hi Bram,

I understand what you mean and I understand that the behavior can be misleading when you simulate the movement. 

It is better if you do something like this to properly check the feasibility and simulate the move afterwards:

# Turn off rendering while doing the calculations (faster and it avoid the robot to be displayed in the final point):

# Check if movement causes any collisions.
if robot.MoveJ_Test(joints_from, joints_to, 1) > 0:
    print('The robot cannot reach target because it is out of reach or causes collision.')
    return False

# Set the robot to the last known position:

# Execute movement

return True

Some notes:
  1. setJoints just sets the robot position in the simulation, not a real robot or a robot program if your goal is to generate a program.
  2. Using Render is not required but it will prevent you from seing the robot jump unexpectedly.

Users browsing this thread:
1 Guest(s)