MATLAB: Rack and pinion on moving base SimMechanics 1st generation

rack and pinionsimmechanicssimmechanics 1st generationSimscapeSimscape Multibodysimulink

Hi,
I'm working on full vehicle simulations and on steering systems in particular. For my application I want to use a rack-and pinion to model the steering system. In my case the pinion is the steering-wheel input (axis which is fixed by a revolute joint to the chassis), the rack is the steering-rack which is connected to the tie rod and can translate wrt the chassis (prismatic joint). The whole chassis is of course not fixed in space but is driving around as well.
I've started of with the demonstration file mech_rack_pinion as provided by MATLAB. This file makes use of a velocity driver to link the translational velocity of the rack to the rotational velocity of the pinion.
I've altered this example slightly to correspond with the following drawing:
As you can see the pinion should rotate according to the relative velocity of the rack w.r.t. the chassis. However in my model it rotates according to the global velocity of the rack. I can't seem to change this in the velocity driver block since the options there are very limited.
I've tried to change the orientation of the coordinate systems from world to base and follower but this doesn't help since the orientation of the axis is not the problem..
I've attached my file to show you the problem. I need this to work in SimMechanics 1st generation since my whole car-model is build in this as well.
Jan

Best Answer

Thanks for the explanation of the issue you are facing and attaching the reproduction model. I was able to reproduce this issue and have put together a workaround for this issue.
Tony is correct, the velocities used in calculations by the Velocity Driver block are measured in the world frame, there is no option to use a local coordinate frame with this block.
The most simple way to workaround this limitation is to actuate both the Revolute and Prismatic joints separately rather than using the velocity driver block between the two to set up the rack and pinion constraint. I have modified the reproduction model you posted to demonstrate this workaround and have verified that the rack and pinion behaves correctly with both translation and rotation of the car chassis. Note that both the revolute and prismatic joint are actuated with the same signal aside from fact that the signal going into the pinion accounts for the pinion radius.
If possible it may be worth your time to modify the model to use SimMcechanics 2nd generation. There have been many improvements to 2nd generation, updated graphics rendering, better ability to componentize and reuse portions of the model, and updated constraints such as a gear constraint and rack and pinion constraint.