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

Dynamic footprint? #53

Open
RGring opened this issue Oct 10, 2018 · 3 comments
Open

Dynamic footprint? #53

RGring opened this issue Oct 10, 2018 · 3 comments

Comments

@RGring
Copy link

RGring commented Oct 10, 2018

I would like to simulate a walking person (i.e. legs) with two circles, moving back and forward over time. Is it possible to have dynamic models with changing footprints? I didn't find the appropriate interface...

@josephduchesne
Copy link
Member

You'd probably want to create a model plugin that expects a model with bodies of particular names "left leg" "right leg" "torso". I would recommend having maybe a body with the torso that you move around on the "3d" layer (that 3d sensors can see), to track where the person is (visually for debugging in rviz/flatland viz).

Each leg could just be a polygon or circle body (density 0 may help) that's either attached to the torso body either by explicitly setting the relative position during the plugin's BeforePhysicsStep, or by using a joint.

See tricycle_drive.cpp for examples of using GetModel()->GetBody(body_name) and GetModel()->GetJoint(joint_name), validating that the joints exist, casting to known joint types etc. It might be easiest to set a fixed joint between the "torso" object and each "massless" (density 0) leg. The physics engine will probably enforce the position for you.

You can also see the Tween plugin's BeforePhysicsStep where it manually sets the position of the body that it manages. I wouldn't recommend doing it that way since this breaks the interactive marker integration, unless you take into account relative motion that might be introduced. I'm hoping to update the Tween plugin at some point to fix this (#29).

This way your person objects may interact nicely with the interactive mark integration.

Flatland is a pretty thin layer on top of Box2D (it could have been named "Box2D with TF, Yaml loading, and Pluginlib" reasonably accurately), so feel free to check out the box2d manual: http://box2d.org/manual.pdf to get a better idea of how to muck with the underlying physics entities.

If this seems daunting, this is also something I've wanted to add for a while, so feel free to submit a partial implementation and I can try to help out. Alternatively, I may have time this weekend to work on a bare bones version of this.

@RGring
Copy link
Author

RGring commented Oct 11, 2018

First of all thanks for the detailed reply.
My problems are the following:

  • If I set the position of the body-parts (right_leg, left_leg), the position isn't updated properly. Not just the marker integration breaks, but also the laserscan data represents the old initialized configuration of the body-parts (sometimes).
  • Setting the velocity of the body-parts is also no option, because I work with weld-joints and finally the whole body moves, instead of just the leg.

I think, I might need another joint. If you have any more suggestions, please don't hesitate. But I might also dig into box2d.

@RGring
Copy link
Author

RGring commented Oct 12, 2018

I found a way to accomplish it. I didn't use any joints and set the velocity and position of each body separately. It's maybe not the nicest way and I still have to check if it slows down the simulation essentially. Thanks for your support so far!

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

No branches or pull requests

2 participants