Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove MoveIt exceptions #1117

Closed
wants to merge 2 commits into from

Conversation

henningkayser
Copy link
Member

This is as part of #1038. I think using something like std::optional or std::expected is much nicer than throwing exceptions, especially with constructors. There are still some other core classes that use exceptions, with this I wanted to continue the discussion about API changes like this.

@v4hn
Copy link
Contributor

v4hn commented Mar 15, 2022

Yes to getting rid of boost::noncopyable (hell, that was in there? 😕 ) and also bye bye createRobotModel (redundant method).

I would actually propose to just remove the PlanningScene(urdf_model, srdf_model) constructor right away instead of deprecating it. There is not much use in constructing a PlanningScene that way, because a RobotModel holds the same information and is the much more appropriate datastructure here.
Removing this constructor already suffices to get rid of the exceptions though and I don't think it's useful to move to a monadic factory method.

In theory I agree with the idea of monadic returns. I also agree with the idea of factories when constructors would need to "do some work". But in this case there is not much going on in the constructor and I do think

planning_scene::PlanningScene scene{ robot_model }

or even

auto scene{ planning_scene::PlanningScene{ robot_model } }

reads a lot better than

auto scene{ planning_scene::PlanningScene::create(robot_model).value() }

@AndyZe
Copy link
Member

AndyZe commented Mar 15, 2022

I do think

planning_scene::PlanningScene scene{ robot_model }

or even

auto scene{ planning_scene::PlanningScene{ robot_model } }

reads a lot better than

auto scene{ planning_scene::PlanningScene::create(robot_model).value() }

Agree with this! I'm not a fan of "always auto"

@henningkayser
Copy link
Member Author

I would actually propose to just remove the PlanningScene(urdf_model, srdf_model) constructor right away instead of deprecating it.

Sure thing, will do!

The point of the create() function is that it's allowed to fail gracefully. With the constructor, we have no other choice but throwing an exception or flagging the instance invalid. I agree, however, that a plain constructor would be nice.

@v4hn
Copy link
Contributor

v4hn commented Mar 17, 2022

The point of the create() function is that it's allowed to fail gracefully. With the constructor, we have no other choice but throwing an exception or flagging the instance invalid.

I'm aware of that, but there are simply no things left in the constructor now that need graceful failure handling. 🙂
and adding the additional .value() everywhere is only worth the hassle when there are failure cases.

If you want to propose consistent factory methods for all classes as a standard interface, that's different (and a lot of rewriting). but then we should check how much that would blow up the caller side using moveit interfaces.

@henningkayser
Copy link
Member Author

The point of the create() function is that it's allowed to fail gracefully. With the constructor, we have no other choice but throwing an exception or flagging the instance invalid.

I'm aware of that, but there are simply no things left in the constructor now that need graceful failure handling. slightly_smiling_face and adding the additional .value() everywhere is only worth the hassle when there are failure cases.

RobotModel could be null

@v4hn
Copy link
Contributor

v4hn commented Mar 21, 2022 via email

@mergify
Copy link

mergify bot commented Mar 24, 2022

This pull request is in conflict. Could you fix it @henningkayser?

1 similar comment
@mergify
Copy link

mergify bot commented Sep 27, 2022

This pull request is in conflict. Could you fix it @henningkayser?

@tylerjw tylerjw self-assigned this Nov 18, 2022
@mergify
Copy link

mergify bot commented May 8, 2023

This pull request is in conflict. Could you fix it @henningkayser?

1 similar comment
@mergify
Copy link

mergify bot commented Aug 11, 2023

This pull request is in conflict. Could you fix it @henningkayser?

@tylerjw
Copy link
Member

tylerjw commented Aug 23, 2023

Sadly this work seems to be abandoned. I'll open an issue to track continuing this work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants