Revolute Joints

92 views
Skip to first unread message

Ethan Evans

unread,
Apr 28, 2024, 2:53:29 PM4/28/24
to ProjectChrono
Hey all!
Brand new user here and I am struggling with something that is probably an obvious misunderstanding on my part. I would like to create a joint using the ChLinkLockRevolute(). Think a pendulum where object "Flap1" rotates about object "base"

Initially, the objects have the coordinate frame: (0,0,0.05, 1, 0, 0, 0) and (0,0,0.7, 1, 0, 0, 0) and I would like it to rotate about the Global Y-axis (see photo below). 

Revolute Joint.png
The code below is my attempt and results in rotation about the global Z-axis instead (where "flap first moves to align with the X-axis). I attached a GIF of the output (I have gravity defined in the g=(1,1,1) direction for troubleshooting).

 I cannot figure out my mistake, I am guessing I am confused about how the initialize and/or the local object Coordinate frames are being modified? Any help or examples to show where my method is going wrong would be much appreciated.

        ::chrono::ChQuaternion<>x2z;
        x2z.Q_from_AngY(::chrono::CH_C_PI/2); // Rotates pi/2 around the Y-axis
        base->SetRot(x2z);

        auto joint1 = std::make_shared< ::chrono::ChLinkLockRevolute>(); 
        joint1->SetName("RevoluteJointConstraint_1");

        ::chrono::ChVector<> position1(flap_origin(0), flap_origin(1), flap_origin(2)); //flap_origin is the point of desired rotation
        joint1->Initialize(base,flap1, ::chrono::ChCoordsys<>(position1, ::chrono::CH_C_PI_2, ::chrono::ChVector<>(0.0, 1.0, 0.0)));
        m_chrono_system->AddLink(joint1);

Additional note: I am coupling chrono here with an additional code GPUSPH for CFD and so am working with chrono 6.0.0 version.

Thank you!
Evans

Chrono_Forum_Example.gif

Radu Serban

unread,
May 3, 2024, 7:00:15 AM5/3/24
to ProjectChrono

Evans,

 

First of all, Chrono 6.0 is a *very* old release.  There have been numerous improvements, additions, and bug fixes in the last 3 years.  If at all possible, I strongly encourage you to start using newer code, ideally the latest code in the main branch (which will be soon released as version 9.0).  In addition, we do not have the bandwidth to provide help for Chrono versions that are that old.

 

As for your problem with the revolute joint, keep in mind that in the particular way in which you initialize the joint, the frame (ChCoordsys) you pass as the 3rd argument to Initialize() is expressed in the global frame.  The revolute joint will be constructed with its rotation axis along the Z axis of that frame.  For what you want, you must therefore pass a frame that has its Z axis along the global Y.  You get that through a rotation of 90 degrees about X (while what you are currently passing is a frame rotated 90 degrees about Y).

 

--Radu

 

From: projec...@googlegroups.com <projec...@googlegroups.com> On Behalf Of Ethan Evans
Sent: Sunday, April 28, 2024 8:53 PM
To: ProjectChrono <projec...@googlegroups.com>
Subject: [chrono] Revolute Joints

 

Hey all!

Brand new user here and I am struggling with something that is probably an obvious misunderstanding on my part. I would like to create a joint using the ChLinkLockRevolute(). Think a pendulum where object "Flap1" rotates about object "base"

 

Initially, the objects have the coordinate frame: (0,0,0.05, 1, 0, 0, 0) and (0,0,0.7, 1, 0, 0, 0) and I would like it to rotate about the Global Y-axis (see photo below). 

 

The code below is my attempt and results in rotation about the global Z-axis instead (where "flap first moves to align with the X-axis). I attached a GIF of the output (I have gravity defined in the g=(1,1,1) direction for troubleshooting).

 

 I cannot figure out my mistake, I am guessing I am confused about how the initialize and/or the local object Coordinate frames are being modified? Any help or examples to show where my method is going wrong would be much appreciated.

 

        ::chrono::ChQuaternion<>x2z;
        x2z.Q_from_AngY(::chrono::CH_C_PI/2); // Rotates pi/2 around the Y-axis

        base->SetRot(x2z);

 

        auto joint1 = std::make_shared< ::chrono::ChLinkLockRevolute>(); 

        joint1->SetName("RevoluteJointConstraint_1");


        ::chrono::ChVector<> position1(flap_origin(0), flap_origin(1), flap_origin(2)); //flap_origin is the point of desired rotation
        joint1->Initialize(base,flap1, ::chrono::ChCoordsys<>(position1, ::chrono::CH_C_PI_2, ::chrono::ChVector<>(0.0, 1.0, 0.0)));

        m_chrono_system->AddLink(joint1);

 

Additional note: I am coupling chrono here with an additional code GPUSPH for CFD and so am working with chrono 6.0.0 version.

 

Thank you!

Evans

 

--
You received this message because you are subscribed to the Google Groups "ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email to projectchron...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/e5d357bb-3488-4b93-a733-4fe5ff5193c6n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages