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

Attitude of Mass of Cylinder and Capsule Wrong #56

Open
basil-huber opened this issue Oct 20, 2016 · 3 comments
Open

Attitude of Mass of Cylinder and Capsule Wrong #56

basil-huber opened this issue Oct 20, 2016 · 3 comments
Labels

Comments

@basil-huber
Copy link

In the functions Model::addCylinder(...) and Model::addCapsule take the direction of the axis of the cylinder. We pass this direction to dMassSetCylinderTotal. We then set the cylinder's attitude depending on the orientation. This means we first set the orientation of the mass correct and then turned it to be wrong.

boost::shared_ptr<SimpleBody> Model::addCylinder(float mass,
        const osg::Vec3& pos, int direction, float radius, float height,
        int label) {
    dMass massOde;
    dMassSetCylinderTotal(&massOde, mass, direction, radius, height);
    dxGeom* g = dCreateCylinder(this->getCollisionSpace(), radius, height);
    osg::Quat rotateCylinder;
    if (direction == 1) {
        rotateCylinder.makeRotate(osg::inDegrees(90.0), osg::Vec3(0, 1, 0));
    } else if (direction == 2) {
        rotateCylinder.makeRotate(osg::inDegrees(90.0), osg::Vec3(1, 0, 0));
    }

    boost::shared_ptr<SimpleBody> body(new SimpleBody(shared_from_this(),
                massOde, g, pos, rotateCylinder));
    this->addBody(body, label);
    return body;
@jauerb
Copy link
Collaborator

jauerb commented Oct 20, 2016

Perhaps you are right? I would have to take a closer look. Do you have
a demo showing the wrong behavior?

On 10/20/2016 10:15 AM, Basil Huber wrote:

In the functions Model::addCylinder(...) and Model::addCapsule take
the direction of the axis of the cylinder. We pass this direction to
dMassSetCylinderTotal. We then set the cylinder's attitude depending
on the orientation. This means we first set the orientation of the
mass correct and then turned it to be wrong.

|boost::shared_ptr Model::addCylinder(float mass, const
osg::Vec3& pos, int direction, float radius, float height, int label)
{ dMass massOde; dMassSetCylinderTotal(&massOde, mass, direction,
radius, height); dxGeom* g =
dCreateCylinder(this->getCollisionSpace(), radius, height); osg::Quat
rotateCylinder; if (direction == 1) {
rotateCylinder.makeRotate(osg::inDegrees(90.0), osg::Vec3(0, 1, 0)); }
else if (direction == 2) {
rotateCylinder.makeRotate(osg::inDegrees(90.0), osg::Vec3(1, 0, 0)); }
boost::shared_ptr body(new SimpleBody(shared_from_this(),
massOde, g, pos, rotateCylinder)); this->addBody(body, label); return
body; |


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#56, or mute the thread
https://github.com/notifications/unsubscribe-auth/ABqWT0kRcSHmdYlgohbnGweN_QgGDmZdks5q13d0gaJpZM4KcLeb.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/lis-epfl/robogen","title":"lis-epfl/robogen","subtitle":"GitHub
repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open
in
GitHub","url":"https://github.com/lis-epfl/robogen"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Attitude
of Mass of Cylinder and Capsule Wrong (#56)"}],"action":{"name":"View
Issue","url":"https://github.com/lis-epfl/robogen/issues/56"}}}

Dr. Joshua E. Auerbach
Postdoctoral Researcher
Laboratory of Intelligent Systems
École Polytechnique Fédérale de Lausanne

@basil-huber
Copy link
Author

I'll upload one tomorrow

@basil-huber
Copy link
Author

I uploaded a demo of the bug on the following branch:
https://github.com/basil-huber/robogen/tree/test/inertia

To execute, just run ./inertia-test; In the test case, a torque is applied to a cylinder along different axis. The cylinder is expected to rotate fastest around its axis of symmetry (z) and slow around the other axis. However, it rotates fastest around the x axis, indicating that the moment of inertia has its axis of symmetry along the x axis.

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

Successfully merging a pull request may close this issue.

2 participants