Menu

Topic-icon Reset encoder counter causes a jump

More
4 years 4 months ago #29531073 by Brogath
When I reset the encoder counter via script using setcommand(_C, 1, 0) the motor jumps a bit.
It seems a high amount of amps is briefly blasted through the motor before it calms down.

After the burst the motors work normally and i cannot see any problems while they run.

The motors are in closed-loop speed mode while the vehicle is driving.
The motors are set to open-loop before I reset the encoder count.
Once reset, the motors are set back to closed-loop

This is the code:
setconfig(_MMOD, 1, 0)
setconfig(_MMOD, 2, 0)
setcommand(_C, 1, 0)
setcommand(_C, 2, 0)
setconfig(_MMOD, 1, 1)
setconfig(_MMOD, 2, 1)

The motor command is always 0 when this piece of code is run.

I am using a MDC2230

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

  • roboteq
  • roboteq's Avatar
4 years 4 months ago #29531074 by roboteq
Replied by roboteq on topic Reset encoder counter causes a jump
The controller runs through a loop every 1ms. You need to allow at least that much time for a change to take effect. Add wait statements as shown:

setconfig(_MMOD, 1, 0)
setconfig(_MMOD, 2, 0)
wait(5)
setcommand(_C, 1, 0)
setcommand(_C, 2, 0)
wait(5)
setconfig(_MMOD, 1, 1)
setconfig(_MMOD, 2, 1)

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

More
4 years 4 months ago #29531083 by Brogath
5mS did not fully solve the problem, it often worked well for one motor but the other still made a jump.

Increasing the wait command to 10mS appears to have solved the matter as it has not occured since the change.

Thank you for your assistance.

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

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