RobotLabLTH / skiros2

A skill-based platform for ROS v.2
Other
163 stars 20 forks source link

New: Adds better feedback on wrong return values. #67

Closed matthias-mayr closed 1 year ago

matthias-mayr commented 1 year ago

Before, a failing "onStart" was difficult to detect. Also if no return value was provided. A wrong 'execute' return value resulted in a failing assertion.

When "onStart" does not succeed, only this feedback was provided by SkiROS:

[BtTicker]          Execution starts.
[VisitorStart]      Root-task_43(State.Running)[]
[Autoparametrize]   Resolving skiros:KpListener:['Robot']
MatchWm             skiros:KpListener:[Robot=cora:Robot-1-cp:ur5e_robot]
[VisitorStart]      KpListener-kp_listener(State.Failure)[Keypoints:[] MaxAge:[0.2] Robot: cora:Robot-1-cp:ur5e_robot ]
[VisitorExecute]    Root-task_43(State.Failure)[]
[BtTicker]          Execution stops.

I would not expect that people actively build a failing "onStart" function in their program flow. If this would be the case, the warning should only be given if it is something else than "False" to help the people who forget the return value.

frvd commented 1 year ago

Nice!

matthias-mayr commented 1 year ago

It looks like I was a bit too quick with the return value of "execute". The line should have been

if type(return_state) is not State:

Also the assert can go now. It would not be reached.