Hello Radu,
Here a minimal working example:
#include "chrono/physics/ChSystemNSC.h"
#include "chrono/physics/ChBodyEasy.h"
#include "chrono/core/ChRealtimeStep.h"
#include "chrono/physics/ChLinkMotorRotationAngle.h"
#include "chrono_irrlicht/ChVisualSystemIrrlicht.h"
using namespace chrono;
using namespace chrono::irrlicht;
int main(int argc, char* argv[])
{
// Create a Chrono physical system
ChSystemNSC sys;
sys.SetGravitationalAcceleration(ChVector3d(0, 0, -9.81));
// Create ground
auto ground = chrono_types::make_shared<ChBodyEasyBox>(100, 100, 0.01,
1000, true, false);
ground->SetFixed(true);
sys.Add(ground);
// Create pendulum
auto link = chrono_types::make_shared<ChBodyEasyBox>(0.1, 0.1, 1.0,
1000, true, false);
link->SetPos(ChVector3d(0, 0, 0.5));
sys.Add(link);
// Create motor
auto motor = chrono_types::make_shared<ChLinkMotorRotationAngle>();
motor->Initialize(ground, link, ChFramed(ChVector3d(0, 0, 1),
EIGEN_PI/2, ChVector3d(1, 0, 0)));
auto function = chrono_types::make_shared<ChFunctionRamp>();
function->SetStartVal(0.0);
function->SetAngularCoeff(3.0);
motor->SetAngleFunction(function);
sys.Add(motor);
// Create the Irrlicht visualization system
auto vis = chrono_types::make_shared<ChVisualSystemIrrlicht>();
vis->AttachSystem(&sys);
vis->SetWindowSize(800, 600);
vis->SetWindowTitle("A simple controlled pendulum");
vis->Initialize();
vis->AddLogo();
vis->AddSkyBox();
vis->AddCamera(ChVector3d(0, -1, 1.0));
vis->AddTypicalLights();
// Simulation loop
double timestep = 0.01;
ChRealtimeStepTimer realtime_timer;
while (vis->Run())
{
vis->BeginScene();
vis->Render();
vis->EndScene();
sys.DoStepDynamics(timestep);
realtime_timer.Spin(timestep);
std::cout << "Angle: " << motor->GetMotorAngle() << std::endl;
std::cout << "Angular speed: " << motor->GetMotorAngleDt() <<
std::endl;
std::cout << "Angular acceleration: " << motor->GetMotorAngleDt2()
<< std::endl;
}
return 0;
}
It is returning the correct angle and speed, that is:
- Angle(t) = 3*t
- Angular_Speed(t) = 3
But it is always giving an acceleration of 0.0674975, instead of 0.
Kind regards,
Simone
On Wednesday, February 4, 2026 at 10:19:09 AM UTC+1 Radu Serban wrote:
> Simone,
>
>
>
> I cannot reproduce this.
>
> - How do you specify the motor angle function?
> - What do you mean by the angular acceleration being “significantly
> different” from 0?
>
>
>
> --Radu
>
>
>
> *From:* [email protected] <[email protected]> *On
> Behalf Of *Simone
> *Sent:* Monday, January 5, 2026 3:55 PM
> *To:* ProjectChrono <[email protected]>
> *Subject:* [chrono] ChLinkMotorRotationAngle::GetMotorAngleDt2() -> wrong
> acceleration
>
>
>
> Hi,
>
>
>
> I have a vary basic system consisting of a rotating body, controlled by an
> infinite stiffness servo, thus being represented by
> a ChLinkMotorRotationAngle. Even though I am prescribing a constant angular
> speed, GetMotorAngleDt2() is returning values significantly different than
> 0. This is happening for various time steppers (HHT, ...) and linear
> solvers, except for EULER_IMPLICIT time stepper. I also tried changing the
> tolerances and time steps with no satisfactory results. Is this a known
> issue, or am I doing or interpreting something wrong?
>
>
>
> Thank you in advance, and best regards,
>
> Simone
>
> --
> 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 [email protected].
> To view this discussion visit
> https://groups.google.com/d/msgid/projectchrono/65ed1c85-625f-4338-86c0-fa6525e9d590n%40googlegroups.com
>
> <https://urldefense.com/v3/__https:/groups.google.com/d/msgid/projectchrono/65ed1c85-625f-4338-86c0-fa6525e9d590n*40googlegroups.com?utm_medium=email&utm_source=footer__;JQ!!Mak6IKo!MXB5146m7smr9Bbv6odg1lU0pB_S58FhIVCabblRVBylnV1BJXlxSl0z59e_fGFODejHmFyUBCLUdgnKf1-hDMu65YI$>
> .
>
--
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 [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/projectchrono/facfabda-c420-4d3d-b9c7-a386943e386an%40googlegroups.com.