ChLinkMotorRotationAngle::GetMotorAngleDt2() -> wrong acceleration

65 views
Skip to first unread message

Simone

unread,
Jan 5, 2026, 9:54:34 AMJan 5
to ProjectChrono
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

Radu Serban

unread,
Feb 4, 2026, 4:19:09 AM (4 days ago) Feb 4
to ProjectChrono

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

--
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 visit https://groups.google.com/d/msgid/projectchrono/65ed1c85-625f-4338-86c0-fa6525e9d590n%40googlegroups.com.

Simone

unread,
Feb 7, 2026, 6:14:00 AM (yesterday) Feb 7
to ProjectChrono
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
Reply all
Reply to author
Forward
0 new messages