Ask Your Question
0

MoveItCommanderException: Error setting joint target. Is the target within bounds?

asked 2018-05-13 10:38:00 -0500

Kashyap.m94 gravatar image

Hey guys,

I have a 5 DOF arm. I am controlling it with an XBOX 360 controller.

Now, the maximum limits my arm can reach is +/-3.1 radians. As soon as it reaches either of the limitations, it throws the following error:

[ERROR] [1526221188.380066]: bad callback: <function callback at 0x7f48e9de4e60>
Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/home/kashyap/catkin_ws/src/igus_trajectory_planning/scripts/set_joy.py", line 123, in callback
    group1.set_joint_value_target(group1_variable_values)
  File "/home/kashyap/catkin_ws/src/moveit/moveit_commander/src/moveit_commander/move_group.py", line 227, in set_joint_value_target
    raise MoveItCommanderException("Error setting joint target. Is the target within bounds?")
MoveItCommanderException: Error setting joint target. Is the target within bounds?

In my code, i am trying to print 'position not reachable' when it reaches either of the 2 extremes. Any suggestions as to how can I avoid the long error message from above in favour of 'position not reachable' ?

edit retag flag offensive close merge delete

Comments

Do you want your code to terminate in the case of an out of bounds joint angle? Or do you want it to move to the closest in bounds angle while displaying an error message?

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-05-13 11:45:44 -0500 )edit

Maybe display an error message, but not terminate the entire program

Kashyap.m94 gravatar image Kashyap.m94  ( 2018-05-13 11:54:18 -0500 )edit

any suggestions, @PeteBlackerThe3rd ?

Kashyap.m94 gravatar image Kashyap.m94  ( 2018-05-14 05:43:58 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2018-05-16 07:30:39 -0500

Kashyap.m94 gravatar image

I made a few changes in the code (below) and this worked fine. Here, i declared j1 as a global variable and initialized it as 0. This worked.

if ((data.buttons[0]==1) and (data.axes[6]==1)):
    time.sleep(1)
    j1 += 0.1
    if (j1 >= 3.1): 
        group1_variable_values[0] = 3.1
        print "Limit reached joint 1"
    else:
        print "changing joint 1"
        group1_variable_values[0] = j1
edit flag offensive delete link more
1

answered 2018-05-14 08:44:01 -0500

Okay, I'm assuming set_joy.py is the node that you have written and at the moment if you pass out-of-range values to set_joint_value_target then you're node is crashing with the error message shown in your question. Correct me if I'm wrong or my answer isn't going to help you.

To achieve what you want you'll need to make sure your node never sends out-of-range values to MoveIt as well as detect those errors and warn the user. This should be fairly simple if you create a loop to iterate through each of the angles in group1_variable_values. Inside this loop you want to check if the angle is outside of +/- PI, if it is then print a warning using ROS_WARN and clamp the value by setting it to +/- PI as appropriate.

After that you can safely call set_joint_value_target without the risk of it throwing an exception.

You could achieve the same thing using a try ... catch block but in my opinion this solution is tidier.

edit flag offensive delete link more

Comments

Thanks. I will apply this today and update you on the same

Kashyap.m94 gravatar image Kashyap.m94  ( 2018-05-15 03:35:16 -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

1 follower

Stats

Asked: 2018-05-13 10:38:00 -0500

Seen: 1,194 times

Last updated: May 16 '18