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

How to get Unreachable target information exception

#1
Hello
When asking for a robot movemet through API, I would like to get the feedback message in case of problem.
Like "unreachable target" "joint axis limits", in other words the cause of the problem.

Thanks to the event loop example, and browsing through the robodk_api.h I saw that it should be possible to get this information because messages exist :-)

However I can not use the eventloop because it causes some troubles with my application. It is not responsive enough. So I would like to check these feedback messages from my own function.

Unfortunately, I did not understood from the documentation how to do that....

Any idea that could help me?
Many thanks
#2
You can use the MoveJ_Test and MoveL_Test functions to know if a movement is feasible before you try to run it on the robot.
#3
Hello
I can get the collision information without using MoveJ_Test or MoveL_Test.
But What I would like to get is not the collision but the reason of unreachability for a given target....
I am pretty sure there is a nice way to get it :-)
#4
You can then provoke the movement using the MoveJ or MoveL functions and catch the exception raised which has the relevant information.

You can run the simulation at max speed to obtain the desired result as quickly as possible. You can also change the run mode to a quick validation and it skips all the simulation steps.
#5
Hello Albert,

I tried to catch exception, however I did not find specific exception for RDK.

I saw in C# API that there was a specific RdkException, but I did not find the same in c++ api.

Thus I tried to catch the exception using basic std::exception.

I am not using a program I am streaming target (xyzwpr) through MoveJ and MoveL.
So I wrote this (for linear movement and similar one for joint movement):
Code:
try
{
    itm->MoveL(pose, blocking);
}
    catch (const std::exception& e)
{
    qDebug() << e.what();
}
When I try to follow a trajectory where some targets are not reachable (in the test case the target is not reachable because of robot configuration) the robot does not reach the target but no exception is caught.

The robot simply does not move, it is simply  waiting for a reachable target to continue the movement.

Is there a specific Exception to be used?
Do you have any example for catching exception during a movement using C API?

Thanks a lot for your help in this matter.
Have a nice day
#6
We'll be updating the RoboDK API in C++ to properly throw exceptions and you should be able to intercept it with your try/catch.

In the meantime, as a workaround, you can find the check_status function in the robodk_api.cpp file which has a hint on where the error should be thrown from (lines 3444, 3447 and 3449).
#7
Hello Albert
Thank you for yor feedback
I already hacked a little bit the check_status function to get needed information.

Thus I can get the "unreachable target" message and I also can get the ID number of problem leading to this situation.
However this ID in case of error is 10 (at least that's the only one I saw).

So I translated it into my own message "joints configuration or axis limits problems" but....

I do not know if there is a way to enrich the catalog of errors (joint limits, singularity, configuration limitation.....), but if you plan to update the API I think that having access to all possible problems would be great and useful.
Also the joint configuration setting could be great (I mean setting of configuration to allow or inhibit some configurations, indepedantly of the configuration defined by a first PTP movement before calling Linear movement). As this is possible from your very nice interface it would be great to acces it also from the API.

I know it is not yet Christmas, but it is not a reason to not prepare a wishlist :-)
Have a nice day
#8
Thank you for your feedback.

You should be getting a description of the exception with the string text that follows the error status code.
#9
I've pushed an initial branch of the RoboDK API for Cpp with exceptions, by default they're off so as not to break compatibility with older code, InstructionListJoints can also be used to find out which instruction in a program is causing a problem and gives more detailed error messages.

The C# API and Python unit tests have code that show how to construct detailed error messages, I can port an example to C++ if that would help.

CPP api branch with support for exceptions:
https://github.com/RoboDK/RoboDK-API/tre...exceptions
  




Users browsing this thread:
1 Guest(s)