Menu

Topic-icon Magnetic Sensor for full size vehicle steering

More
3 years 5 months ago #29532135 by mrosenfield
I am using the magsensor with multi-pwm to talk to the MDC2230 running a steering motor connected to the steering wheel of a full size car.
I am finding that, no matter how I tune the PID loop, the steering just doesn't react fast enough to follow the magnetic tape.
After reading the MGS data sheet more carefully, I realized the multi-PWM only updates at 100Hz, which is way too slow for this application.

So, the question is, would CAN, RS-232, or analog output provide faster position updates, and what is that position update rate?

Second question - I am currently implementing the PID control loop in the MDC controller script. As I understand it, the script can execute at a maximum rate of 1 mSec rate - but it is recommended that the script loop be run slower than this.
The PID section of my script is about 20 lines of code, plus 6 or lines that perform other operations occasionally.
Is this code likely to have enough time to run once very mSec?

If I were to implement the PID algorithm in an external uController, and feed the position information to the MDC via CAN or RS-232, then I would remove the script burden from the MDC.
Obviously, the steering motor can't react any where near this rate, but the control algorithm would update the position errors much faster.
Do you think this approach would be of any value?

Thank you!

Please Log in or Create an account to join the conversation.

  • roboteq
  • roboteq's Avatar
3 years 5 months ago #29532141 by roboteq
the 100Hz (10ms) is the time between two reading and evaluation of the sensor. This is the max speed of the sensor, regardless of the communication used.

There should be enough time to run your 20 lines every 1ms. Use wait(0) to have the script loop every 1ms.

Running your control algorithm in the microbasic loop should be quicker than running on external microcomputer because you save the communication overhead.

To be sure, toggle a digital output at every loop and check with scope.

Please Log in or Create an account to join the conversation.

Moderators: tonysantoni
Time to create page: 0.121 seconds
Go to top