Hi Ruochun,
Thank you so much for your help. This actually helped a lot. I have some questions that I hope you could answer. I am trying to control the mesh motion using ApplyMeshMotion as you mentioned. However, I feel like I do not fully understand everything related to that so I wanted to ask some questions and hopefully, this will help others as well. I have looked at the documentation and they are really brief so I hope you could answer some of these questions here. I will use examples from my code(attached here). I might be using some stuff incorrectly so I think it would be a good way to see if what I am doing is correct or not.
1- gpu_sys.AddMesh("../Screw_CM.obj", ChVector<float>(0,0,-90), ChMatrix33<float>(1), screw_mass);
-
ChVector<float>(0,0,-90): does this represent the initial position where the mesh is initiated, and does it affect other parts of the simulation?
- ChMatrix33<float>(1): what does this represent? I looked through the documentation and it says that this is the rotscale. Could you give a little more explanation as to what that is?
2- ChVector<> ball_initial_pos(0, 0, 0);
std::shared_ptr<ChBody> screw_body(sys_screw.NewBody());
screw_body->SetMass(screw_mass);
screw_body->SetInertiaXX(ChVector<>(screw_inertia_x, screw_inertia_y, screw_inertia_z));
screw_body->
SetPos(ball_initial_pos);
screw_body->SetBodyFixed(false);
sys_screw.AddBody(screw_body);
- When creating a system using the imported mesh, what does
screw_body->SetPos(ball_initial_pos) do? Clearly, it is a way to set the position of the mesh. However, since the
ChVector<float>(0,0,-90) was used before when adding the mesh, is there a need to use
SetPos?
3- ChVector<float> mesh_pos(0, 0, 0);
float rev_per_sec = 10.f;
float ang_vel_Z = rev_per_sec * 2 * (float)CH_C_PI;
ChVector<>
mesh_lin_vel(0);
ChQuaternion<>
mesh_rot = Q_from_AngZ(t * ang_vel_Z);
ChVector<>
mesh_ang_vel(0, 0, ang_vel_Z);
gpu_sys.ApplyMeshMotion(0, mesh_pos, mesh_rot, mesh_lin_vel, mesh_ang_vel);
-
mesh_pos(0, 0, 0): to me, it seems that we are setting the position of the mesh a third time. could you explain how this affects the simulation?
-
mesh_lin_vel(0): does this represent the initial velocity of the mesh? or is it applying a constant velocity throughout the entire simulation?
-
mesh_rot : Could you explain what this exactly is and how changing it affects the simulation?
- mesh_ang_vel(0, 0, ang_vel_Z): is this the initial rotational speed or it is a constant rotational speed that the mesh will have throughout the entire simulation?
Thank you so much in advance for taking the time to help us with everything,