G_acc overrides SetPos_dtdt. What's the point?

38 views
Skip to first unread message

Tymo

unread,
Nov 16, 2022, 4:29:24 PM11/16/22
to ProjectChrono
There is a problem with SetPos_dtdt.
coords_dtdt.pos seems to be overwritten with G_acc, so what is the point of SetPos_dtdt?

ChSystemNSC sys;
auto body = make_shared<ChBody>();
sys.AddBody(body);
body->SetPos_dtdt(Vector(0, 1, 0));
cout << body->GetPos_dtdt().y() << endl;//1
sys.DoFrameDynamics(1);
cout << body->GetPos_dtdt().y() << endl;//-9.81 value overwritten
sys.Set_G_acc(Vector(0, 0, 0));
body->SetPos_dtdt(Vector(0, 1, 0));
cout << body->GetPos_dtdt().y() << endl;//1
sys.DoFrameDynamics(2);
cout << body->GetPos_dtdt().y() << endl;//0 value overwritten again


Radu Serban

unread,
Nov 16, 2022, 5:10:34 PM11/16/22
to ProjectChrono

Tymo,

 

You are doing a dynamics analysis, more precisely “forward dynamics”. In this case, the motion of the system is dictated by its initial state (positions and velocities) and the set of applied forces.  Forward dynamics analysis calculates the accelerations (think Newton’s second law a = F/m) and then integrates to find the new velocity and position.

 

In the examples you show, gravity is the only applied force so, as expected, the body’s acceleration will end up being the gravitational acceleration.

 

The function SetPos_dtdt can be used for other types of analysis, for example inverse dynamics.

 

--Radu

--
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/e4fd6b97-06ae-4381-a12f-c45eef5a772an%40googlegroups.com.

Tymo

unread,
Nov 17, 2022, 3:28:06 PM11/17/22
to ProjectChrono

Thank you for clarification
Reply all
Reply to author
Forward
0 new messages