Siyuan, The differences you see between the Chrono and Matlab results could be possibly explained by a delay of 1 step between the calculation of tire-terrain geometry and calculation of tire forces (the reasons why this is happening in Chrono are subtle and beyond the scope of this discussion). Of course, there are many other possible sources for these discrepancies.
I just pushed code to also report the tire forces in a local tire frame. See https://github.com/projectchrono/chrono/blob/9c4ac1c4c1d5bd6a2cee16e6f7980e2520982204/src/chrono_vehicle/wheeled_vehicle/tire/ChForceElementTire.h#L42. Note that I only implemented this for classes derived from ChForceElementTire (so Pac89, Pac02, Fiala, and TMeasy) and didn’t test it. Please let me know if this addresses your needs. --Radu From: [email protected] <[email protected]> On Behalf Of Siyuan Yu Sent: Sunday, 5 February 2023 22:07 To: ProjectChrono <[email protected]> Subject: [chrono] Calculation of Tire forces in tire frame Hi Developers, We would like to ask about the calculations of tire forces in tire frame of wheeled vehicle. The function ReportTireForce reports the tire forces in global frame and we want to examine it in local frame. Here are our calculations: WheelState state0 = vehicle.GetWheel(0, VehicleSide::LEFT)->GetState(); ChVector<> wheel_normal0 = state0.rot.GetYaxis(); ChVector<> contact_point = ChVector<>(state0.pos.x(), state0.pos.y(), terrain.GetHeight(state0.pos)); ChVector<> Z_dir0 = terrain.GetNormal(contact_point); ChVector<> X_dir0 = Vcross(wheel_normal0, Z_dir0); X_dir0.Normalize(); ChVector<> Y_dir0 = Vcross(Z_dir0, X_dir0); ChMatrix33<> rot0; rot0.Set_A_axis(X_dir0, Y_dir0, Z_dir0); ChMatrix33<> rot0inv = rot0.transpose(); double alpha_fl = vehicle.GetTire(0, VehicleSide::LEFT)->GetSlipAngle(); double kappa_fl = vehicle.GetTire(0, VehicleSide::LEFT)->GetLongitudinalSlip(); ChVector<> F_fl = rot0inv * (vehicle.GetTire(0, VehicleSide::LEFT)->ReportTireForce(&terrain).force); ChVector<> M_fl = rot0inv * (vehicle.GetTire(0, VehicleSide::LEFT)->ReportTireForce(&terrain).moment); This calculation meets our expectation to some extent. We reimplement the exact same Pacejka tire force as used in Project Chrono. And we use the exact tire force parameters. To make sure it's not the camber angle problem, we override the camber angle in ChPac02tire.cpp and make it 0 all the time. Our expectations are that they should behave the exactly the same. But the calculation shows that there's an offset when we are using our matlab calculation. [cid:[email protected]] It is not a big deviation in terms of tire force, but it does matter when we are using this in yaw rate calculation. The other one is to use the spindle's rotation to transform the tire forces. That result huge deviations, so we suspect we got it wrong somewhere. Here's the code: ChQuaternion<> rot0inv = vehicle.GetSpindleRot(0, VehicleSide::LEFT); double alpha_fl = vehicle.GetTire(0, VehicleSide::LEFT)->GetSlipAngle(); double kappa_fl = vehicle.GetTire(0, VehicleSide::LEFT)->GetLongitudinalSlip(); ChVector<> F_fl = rot0inv.Rotate((vehicle.GetTire(0, VehicleSide::LEFT)->ReportTireForce(&terrain).force)); ChVector<> M_fl = rot0inv.Rotate(vehicle.GetTire(0, VehicleSide::LEFT)->ReportTireForce(&terrain).moment); We are wondering what is the exact correct way to get the tire forces in tire frame. Thanks in advance! Siyuan -- 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]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/8f4acfa4-81a7-411c-9490-cff47d94f77bn%40googlegroups.com<https://groups.google.com/d/msgid/projectchrono/8f4acfa4-81a7-411c-9490-cff47d94f77bn%40googlegroups.com?utm_medium=email&utm_source=footer>. -- 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/PH0PR06MB823722FEEA122838D9926F81A7A59%40PH0PR06MB8237.namprd06.prod.outlook.com.
