Why does the gear not rotate in this SimMechanics model?

2 views (last 30 days)
I am using SimMechanics (2nd gen) to create a simple model of a motor that drives a gear.
Unfortunately, when I run my model, the drive shaft rotates, but the gear does not. See not_working_example.slx in attached zip file.
I thought the issue may have been that I was missing a joint (e.g. weld) between the shaft and the gear or an angle constraint, but then I noticed something peculiar: when I switch the "gear" shape from General Extrusion to something simpler (e.g. Brick), the model works as expected (see for yourself in working_example.slx).
Why is this happening? How can I fix my model so that the gear rotates?

Answers (1)

Steve Miller
Steve Miller on 20 Nov 2022
In both models, the gear is spinning. It just doesn't look like it it is spinning in the "not_working_model.slx" because of aliasing - each update to the animation makes it look like the gear is in the same position, but it has actually rotated. If you set the maximum step size to something smaller (0.01) you will see the gear rotate.
Note, however, that the gear is only spinning because of an initial velocity target in the Revolute Joint between Motor and Drive Shaft. If you want the motor to spin the gear, delete that Revolute Joint and connect the motor directly to the drive shaft with a connection line. That Revolute Joint inserts a degree of freedom between the Motor and Drive Shaft.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!