Hi Luning, 

thanks for your reply. I agree on the cause of the force and torque 
components, but to my understanding the constant torque vector [0.000, 
-10.000, -0.000] would be correct only in the rotating frame, not in the 
link frame (which is fixed here). 

I modified my example, now using ChLinkLockLock to create the same rotating 
body setup (see below). The torque vector seems to rotate correctly when 
using ChLinkLockLock, in contrast to the ChLinkMotorRotationSpeed case.

Thank you, 
Simon

*Code:*
ChSystemNSC system{};

auto fixed_body{chrono_types::make_shared<ChBody>()};
fixed_body->SetBodyFixed(true);
auto rotating_body{chrono_types::make_shared<ChBody>()};
rotating_body->SetPos({1.0, 0.0, 0.0});

// Option 1: ChLinkMotorRotationSpeed
//        auto 
rotation_link{chrono_types::make_shared<ChLinkMotorRotationSpeed>()};
//        rotation_link->Initialize(rotating_body, fixed_body, ChFrame{});
//       
 
rotation_link->SetSpeedFunction(chrono_types::make_shared<ChFunction_Const>(1.0));

// Option 2: ChLinkLockLock
auto rotation_link{chrono_types::make_shared<ChLinkLockLock>()};
rotation_link->Initialize(rotating_body, fixed_body, {});
rotation_link->Set_angleset(chrono::AngleSet::ANGLE_AXIS);
rotation_link->SetMotion_axis({0.0, 0.0, 1.0});
rotation_link->SetMotion_ang(chrono_types::make_shared<ChFunction_Ramp>(0.0, 
1.0));

system.Add(fixed_body);
system.Add(rotating_body);
system.Add(rotation_link);

system.Set_G_acc({0.0, 0.0, 10.0});

for (double time{}; time < 1.0; time += 0.01)
{
    system.DoFrameDynamics(time);

    std::cout << std::fixed << std::setprecision(3) << "Time: " << 
system.GetChTime()
              << " *** Force: " << rotation_link->Get_react_force()
              << " *** Torque: " << rotation_link->Get_react_torque()
              << " *** Link Absolute Coords: " << 
rotation_link->GetLinkAbsoluteCoords() << "\n";
}

*Output using ChLinkMotorRotationSpeed:*
...
Time: 0.970 *** Force: 0.574  0.819  10.000 *** Torque: 0.000  -10.000 
 -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
 0.000
Time: 0.980 *** Force: 0.565  0.825  10.000 *** Torque: 0.000  -10.000 
 -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
 0.000
Time: 0.990 *** Force: 0.557  0.831  10.000 *** Torque: 0.000  -10.000 
 -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
 0.000

*Output using ChLinkLockLock:*
...
Time: 0.970 *** Force: 0.574  0.819  10.000 *** Torque: 4.662  -8.847 
 -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
 0.000
Time: 0.980 *** Force: 0.565  0.825  10.000 *** Torque: 4.707  -8.824 
 -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
 0.000
Time: 0.990 *** Force: 0.557  0.831  10.000 *** Torque: 4.751  -8.800 
 -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
 0.000

On Friday, March 10, 2023 at 6:27:12 PM UTC+1 [email protected] wrote:

> The object is traveling in a circular motion at a constant angular 
> velocity, 1, with respect to the global z coordinate, gravity pointing 
> downward z. Therefore, link force in xy plane is a centrifugal force, F = 
> mw^2R, pointing towards origin, z component balance out gravitational 
> force. With zero angular acceleration, z-component of link torque is zero, 
> y-component balance out the torque from gravity, since rotation around y 
> and z axis are constrained.
>
> Thank you,
> Luning
>
> On Friday, March 10, 2023 at 12:10:53 AM UTC-6 Simon wrote:
>
>> Hi Luning,
>>
>> thanks for the clarification about the link coordinate system.
>> In my example I added the link coordinate system output to verify that it 
>> is indeed fixed to the global reference frame (see below).
>>
>> Unfortunately my question remains: Why does the link force vector rotate 
>> and the torque vector does not ?  
>>
>> Thank you, 
>> Simon
>>
>>
>> *Code:*
>> ChSystemNSC system{};
>>
>> auto fixed_body{chrono_types::make_shared<ChBody>()};
>> fixed_body->SetBodyFixed(true);
>> auto rotating_body{chrono_types::make_shared<ChBody>()};
>> rotating_body->SetPos({1.0, 0.0, 0.0});
>>
>> auto rotation_link{chrono_types::make_shared<ChLinkMotorRotationSpeed>()};
>> rotation_link->Initialize(rotating_body, fixed_body, ChFrame{});
>>
>> rotation_link->SetSpeedFunction(chrono_types::make_shared<ChFunction_Const>(1.0));
>>
>> system.Add(fixed_body);
>> system.Add(rotating_body);
>> system.Add(rotation_link);
>>
>> system.Set_G_acc({0.0, 0.0, 10.0});
>>
>> for (double time{}; time < 1.0; time += 0.01)
>> {
>>     system.DoFrameDynamics(time);
>>
>>     std::cout << std::fixed << std::setprecision(3) << "Time: " << 
>> system.GetChTime()
>>               << " *** Force: " << rotation_link->Get_react_force()
>>               << " *** Torque: " << rotation_link->Get_react_torque()
>>               << " *** Link Absolute Coords: " << 
>> rotation_link->GetLinkAbsoluteCoords() << "\n";
>> }
>>
>>
>> *Output:*
>> ...
>> Time: 0.830 *** Force: 0.682  0.731  10.000 *** Torque: 0.000  -10.000 
>>  -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
>>  0.000
>> Time: 0.840 *** Force: 0.675  0.738  10.000 *** Torque: 0.000  -10.000 
>>  -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
>>  0.000
>> Time: 0.850 *** Force: 0.667  0.745  10.000 *** Torque: 0.000  -10.000 
>>  -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
>>  0.000
>> Time: 0.860 *** Force: 0.660  0.751  10.000 *** Torque: 0.000  -10.000 
>>  -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
>>  0.000
>> Time: 0.870 *** Force: 0.652  0.758  10.000 *** Torque: 0.000  -10.000 
>>  -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
>>  0.000
>> Time: 0.880 *** Force: 0.645  0.764  10.000 *** Torque: 0.000  -10.000 
>>  -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
>>  0.000
>> Time: 0.890 *** Force: 0.637  0.771  10.000 *** Torque: 0.000  -10.000 
>>  -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
>>  0.000
>> Time: 0.900 *** Force: 0.629  0.777  10.000 *** Torque: 0.000  -10.000 
>>  -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
>>  0.000
>> Time: 0.910 *** Force: 0.622  0.783  10.000 *** Torque: 0.000  -10.000 
>>  -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
>>  0.000
>> Time: 0.920 *** Force: 0.614  0.790  10.000 *** Torque: 0.000  -10.000 
>>  -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
>>  0.000
>> Time: 0.930 *** Force: 0.606  0.796  10.000 *** Torque: 0.000  -10.000 
>>  -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
>>  0.000
>> Time: 0.940 *** Force: 0.598  0.802  10.000 *** Torque: 0.000  -10.000 
>>  -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
>>  0.000
>> Time: 0.950 *** Force: 0.590  0.808  10.000 *** Torque: 0.000  -10.000 
>>  -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
>>  0.000
>> Time: 0.960 *** Force: 0.582  0.813  10.000 *** Torque: 0.000  -10.000 
>>  -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
>>  0.000
>> Time: 0.970 *** Force: 0.574  0.819  10.000 *** Torque: 0.000  -10.000 
>>  -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
>>  0.000
>> Time: 0.980 *** Force: 0.565  0.825  10.000 *** Torque: 0.000  -10.000 
>>  -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
>>  0.000
>> Time: 0.990 *** Force: 0.557  0.831  10.000 *** Torque: 0.000  -10.000 
>>  -0.000 *** Link Absolute Coords: 0.000  0.000  0.000  1.000  0.000  0.000 
>>  0.000
>>
>>
>> On Thursday, March 9, 2023 at 4:59:13 PM UTC+1 [email protected] wrote:
>>
>>> Hello Simon,
>>>
>>> "As I understand, the link coordinate system is the 'master' body system 
>>> (Body2)."
>>> This is not correct. Your link coordinate system is defined here,
>>>
>>> rotation_link->Initialize(rotating_body, fixed_body, ChFrame{});
>>>
>>> ChFrame{} initialize a reference frame coincide with the global 
>>> reference frame. Because your Body2 (fixed_body) has the same orientation 
>>> as the GRF, and it is fixed, it just so happens that your link coordinate 
>>> system is the same as the 'master' body system. 
>>>
>>> You can check the orientation of the  link coordinate system using this: 
>>> auto quat = rotation_link->GetLinkAbsoluteCoords().rot
>>>
>>> Thank you,
>>> Luning
>>>
>>> On Tuesday, March 7, 2023 at 9:45:38 AM UTC-6 Simon wrote:
>>>
>>> Hi, 
>>>
>>> as per the documentation 
>>> <https://api.projectchrono.org/classchrono_1_1_ch_link_motor_rotation_speed.html>,
>>>  
>>> ChLinkMotorRotationSpeed's member functions Get_react_force() and 
>>> Get_react_torque() return the respective values in link coordinates.
>>> As I understand, the link coordinate system is the 'master' body system 
>>> (Body2).
>>>
>>> In the example below a body rotates around the absolute z axis using 
>>> ChLinkMotorRotationSpeed (the 'master' body is fixed here). As expected, 
>>> the link reaction force consists of a the constant body weight in z 
>>> direction and the rotating centrifugal load in the x-y plane. However, the 
>>> reaction torque (due to gravity) is constant despite the link's rotation. 
>>> Shouldn't the torque vector also rotate or do I misunderstand something?
>>>
>>> Thanks in advance!
>>> Simon
>>>
>>>
>>> *Code: *
>>> ChSystemNSC system{};
>>>
>>> auto fixed_body{chrono_types::make_shared<ChBody>()};
>>> fixed_body->SetBodyFixed(true);
>>> auto rotating_body{chrono_types::make_shared<ChBody>()};
>>> rotating_body->SetPos({1.0, 0.0, 0.0});
>>>
>>> auto 
>>> rotation_link{chrono_types::make_shared<ChLinkMotorRotationSpeed>()};
>>> rotation_link->Initialize(rotating_body, fixed_body, ChFrame{});
>>>
>>> rotation_link->SetSpeedFunction(chrono_types::make_shared<ChFunction_Const>(1.0));
>>>
>>> system.Add(fixed_body);
>>> system.Add(rotating_body);
>>> system.Add(rotation_link);
>>>
>>> system.Set_G_acc({0.0, 0.0, 10.0});
>>>
>>> for (double time{}; time < 1.0; time += 0.01)
>>> {
>>>     system.DoFrameDynamics(time);
>>>
>>>     std::cout << std::fixed << std::setprecision(3) << "Time: " << 
>>> system.GetChTime()
>>>               << " *** Force: " << rotation_link->Get_react_force()
>>>               << " *** Moment: " << rotation_link->Get_react_torque() << 
>>> "\n";
>>> }
>>>
>>>
>>> *Output: ...*
>>> Time: 0.810 *** Force: 0.697  0.717  10.000 *** Moment: 0.000  -10.000 
>>>  -0.000
>>> Time: 0.820 *** Force: 0.690  0.724  10.000 *** Moment: 0.000  -10.000 
>>>  -0.000
>>> Time: 0.830 *** Force: 0.682  0.731  10.000 *** Moment: 0.000  -10.000 
>>>  -0.000
>>> Time: 0.840 *** Force: 0.675  0.738  10.000 *** Moment: 0.000  -10.000 
>>>  -0.000
>>> Time: 0.850 *** Force: 0.667  0.745  10.000 *** Moment: 0.000  -10.000 
>>>  -0.000
>>> Time: 0.860 *** Force: 0.660  0.751  10.000 *** Moment: 0.000  -10.000 
>>>  -0.000
>>> Time: 0.870 *** Force: 0.652  0.758  10.000 *** Moment: 0.000  -10.000 
>>>  -0.000
>>> Time: 0.880 *** Force: 0.645  0.764  10.000 *** Moment: 0.000  -10.000 
>>>  -0.000
>>> Time: 0.890 *** Force: 0.637  0.771  10.000 *** Moment: 0.000  -10.000 
>>>  -0.000
>>> Time: 0.900 *** Force: 0.629  0.777  10.000 *** Moment: 0.000  -10.000 
>>>  -0.000
>>> Time: 0.910 *** Force: 0.622  0.783  10.000 *** Moment: 0.000  -10.000 
>>>  -0.000
>>> Time: 0.920 *** Force: 0.614  0.790  10.000 *** Moment: 0.000  -10.000 
>>>  -0.000
>>> Time: 0.930 *** Force: 0.606  0.796  10.000 *** Moment: 0.000  -10.000 
>>>  -0.000
>>> Time: 0.940 *** Force: 0.598  0.802  10.000 *** Moment: 0.000  -10.000 
>>>  -0.000
>>> Time: 0.950 *** Force: 0.590  0.808  10.000 *** Moment: 0.000  -10.000 
>>>  -0.000
>>> Time: 0.960 *** Force: 0.582  0.813  10.000 *** Moment: 0.000  -10.000 
>>>  -0.000
>>> Time: 0.970 *** Force: 0.574  0.819  10.000 *** Moment: 0.000  -10.000 
>>>  -0.000
>>> Time: 0.980 *** Force: 0.565  0.825  10.000 *** Moment: 0.000  -10.000 
>>>  -0.000
>>> Time: 0.990 *** Force: 0.557  0.831  10.000 *** Moment: 0.000  -10.000 
>>>  -0.000
>>>
>>>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/projectchrono/3f34cf29-d88d-4e8b-97e3-1398fd67b6d8n%40googlegroups.com.

Reply via email to