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

Collision Detection #372

Closed
7 of 9 tasks
basicNew opened this issue Apr 24, 2018 · 7 comments
Closed
7 of 9 tasks

Collision Detection #372

basicNew opened this issue Apr 24, 2018 · 7 comments

Comments

@basicNew
Copy link

basicNew commented Apr 24, 2018

Goals

Delphyne can identify and notify when collisions occur, but is not responsible for the physics of collision behaviours. i.e. just report out when a collision occurs.

Work Items

Success Criteria

  • delphyne-crash detects the collision and responds 'appropriately' (to be determined)

Descoped from Milestone 3

@basicNew basicNew added this to the Milestone #3 milestone Apr 24, 2018
@basicNew basicNew self-assigned this Apr 24, 2018
@stonier stonier mentioned this issue Apr 24, 2018
17 tasks
@hidmic
Copy link
Contributor

hidmic commented Jun 5, 2018

Alright, I did some research through Drake's code looking for collision detection support.

In one hand, there's RigidBodyTree. Collision detection is built into the tree, that owns and delegates geometrical computations to an internal collision model. There're two implementations for this model: one based on fcl, the other on bullet. By default, if available, RigidBodyTree will use the bullet-based one.

On the other hand, there's SceneGraph. And not MultibodyTree as you might have guessed. With the multibody namespace revamp, the geometry of a body is now decoupled from its physical properties. This allows systems to interact directly with the topology of their world (through the SceneGraph). This includes collision detection, that currently relies on fcl for the computations and is made available through the QueryObject output of the SceneGraph.

The apparent functionality duplication is due to the fact that, although still around for the time being, RigidBodyTree will be replaced by MultibodyTree in the near future. However, both approaches come with certain caveats. RigidBodyTree does not expose the collision model it builds, making it harder for us to use. SceneGraph is still under active development and thus some parts are still TBD, e.g. it currently lacks support to detect collisions between mesh geometries.

What follows are two potential roadmaps to vehicle collision detection, one for each approach.

Using RigidBodyTree

  • Adapt the Agent::Configure() API to accept a RigidBodyTree and add a body with collision geometries to it using floating joints (e.g. RollPitchYawFloatingJoint).
  • Make the SimulationRunner aggregate all cars' poses into a single generalized position vector q suitable for the RigidBodyTree in order to call RigidBodyTree::doKinematics() followed by RigidBodyTree::updateDynamicCollisionElements() followed by RigidBodyTree::allCollisions().
  • Pass collision information through step callbacks (we can start out with a boolean to state whether there was any collision or not).

Using SceneGraph

  • Instantiate a global SceneGraph within the AutomotiveSimulator and expose it.
  • Adapt car systems (e.g. SimpleCarSystem) to register geometry on a given SceneGraph and update its kinematics accordingly (class documentation is very thorough).
  • Adapt Agent::Configure() API to accept a SceneGraph and perform the necessary wiring within.
  • Make the SimulationRunner retrieve the QueryObject output from the SceneGraph of the simulator and query collision information on every step.
  • Pass collision information through step callbacks (we can start out with a boolean to state whether there was any collision or not).

Note that neither roadmap requires providing physical entity to the cars. And it's important to understand what that means: we will be able to tell if there was a collision between vehicles, but the simulation will not model the collision itself (i.e. no cars crashing or flying around).

@stonier
Copy link
Collaborator

stonier commented Jun 6, 2018

I've been considering steps 1. 2. and 3. of the SceneGraph with the consideration that I know nothing about it's state of readiness right now and it might be a potential rabbit hole that we need to back out of.

Nonetheless, it's worth enduring a bit of pain in that direction just to get us off a path that seems to be finally deprecating.

Your final caveat is spot on. Of all the driving simulations we do here at TRI, collision modelling is never considered. We'll be getting value out of just detecting an imminent collision point for a long time to come.

@hidmic
Copy link
Contributor

hidmic commented Jun 7, 2018

Alright. Moving forward with the SceneGraph approach.

@stonier
Copy link
Collaborator

stonier commented Jun 13, 2018

@basicNew @hidmic I updated this one with the bullets from our planning doc and primed it for the collision detection story rather than create a new one and lose the thread here.

@stonier stonier changed the title Python Layer Improvements Collision Detection Jun 13, 2018
@stonier stonier mentioned this issue Jun 13, 2018
6 tasks
@hidmic
Copy link
Contributor

hidmic commented Jun 21, 2018

Based on the latest additions to the Design Doc, and in line with the goals mentioned in this issue, we're:

Regarding geometries, we'll be sticking to the Prius' one for the time being.

@basicNew
Copy link
Author

@stonier @clalancette Added docs and created new issues for the two remaining items. Are we good on closing this one?

@clalancette
Copy link
Contributor

It looks like it to me. I'll close it out, @stonier can reopen if there is something else to do here.

@basicNew basicNew removed their assignment Apr 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants