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

Safe pythonic access to newly created agents #468

Closed
stonier opened this issue Jun 15, 2018 · 5 comments
Closed

Safe pythonic access to newly created agents #468

stonier opened this issue Jun 15, 2018 · 5 comments
Assignees
Milestone

Comments

@stonier
Copy link
Collaborator

stonier commented Jun 15, 2018

  • Make sure python has a handle (pointer) to the agent after it is passed to the simulator so it can manipulate custom properties of that agent (e.g. the nominal speed)
  • AddAgent should be a bit better at error handling - right now we have c++ coverage! assert, exceptions and return codes.
@stonier
Copy link
Collaborator Author

stonier commented Jun 15, 2018

Error Handling

Prefer not to have asserts in an underlying library. It takes away choice from the user of the library. Exceptions or return codes - I'm fine either way. Maybe a group question on slack to canvas opinions on how we'd generally like to do error handling in the backend?

@stonier
Copy link
Collaborator Author

stonier commented Jun 15, 2018

Some python questions here - how it is handling unique pointers and exceptions?

@clalancette
Copy link
Contributor

I talked to @basicNew and @hidmic about this for a bit today. Here's a quick summary of our discussion:

  1. @basicNew and @hidmic prefer to do exceptions.
  2. The google style guide disallows exceptions. However, this is largely due to legacy concerns.
  3. The drake style guide allows exceptions, but not catch. They essentially function as fancy asserts.
  4. @hidmic suggests that drake internally would not be able to recover if one of our systems did something badly, and thus throwing exceptions in those cases would not be useful (since the application as a whole probably cannot continue).
  5. After some discussion, we came to the conclusion that we should use DELPHYNE_DEMAND for "internal" or drake-related errors, and use exceptions when the user of an API provides invalid arguments.

@stonier Does that sound like a reasonable plan to you?

@clalancette
Copy link
Contributor

After further discussion, we are going to go the drake route of using throw, but not catch. This essentially gives us more fancy asserts, with the possibility of handling them later. PR upcoming.

@clalancette
Copy link
Contributor

This is done as of #502, so closing for now.

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

Successfully merging a pull request may close this issue.

2 participants