Trigger home or reset encoder on each pass

General discussion of using Roboclaw motor controllers
Post Reply
DaAwesomeP
Posts: 3
Joined: Thu Jul 11, 2019 11:53 am
Trigger home or reset encoder on each pass

Post by DaAwesomeP »

Hello,

I am using the roboclaw for continuous rotation, and there does not appear to be a way to programmatically determine the start and end encoder positions for homing. Basically, the motor is spinning at all times but must jump to a certain angle at times. I have tried to measure exactly how many encoder counts one full revolution is, but the reality is that this measurement is inconsistent and will grow in error the longer it spins.

This means that the roboclaw has to be able to do one of the following to work in this situation:
  • Receive a command to re-home at any time. This is not ideal because it adds indirect movement to my program, but I suppose it could work.
  • Report the encoder value and home status at the exact same time even when spinning (I noticed that getting the status via packet 90 does not report if the motor passed home if the motor is spinning). This would allow my program to keep track of a new home offset each time it passes home. It should report the home status and encoder value in the same packet to be the most precise.
  • Have an option to reset the encoder to 0 each time home is triggered (preferred and simplest option). This also means that the encoder value cannot possibly grow too large.
Would it be possible to implement any of these ideas? Is there another way that I'm missing?

Thanks!
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Trigger home or reset encoder on each pass

Post by Basicmicro Support »

What you want is an index functionality. Roboclaw does not currently support index signals.

An index signal would zero the encoder count every time it triggers and adds or subtracts an offset based on the direction the motor was moving to compensate for the width of the index signal.

Homing the encoder currently is only allowed in the reverse direction and it has the side effect that the motor would be stopped.
DaAwesomeP
Posts: 3
Joined: Thu Jul 11, 2019 11:53 am
Re: Trigger home or reset encoder on each pass

Post by DaAwesomeP »

Thank you for your swift response!

Yes, I would want index functionality to count revolutions. I wanted to implement this on the software end of my device, but I can't because the home status isn't sent when the motor is moving. I could add an Arduino into my project to read the home sensor, but there would be a delay between when the home is detected and when I can reset the encoder value.

Is it possible to trigger the automatic homing besides power cycling the roboclaw? This would add extra movement to the device but still allow it to go to a position after continuous rotations.

I am also worried that I could hit the upper limit of the encoder value if it runs all day. What is the maximum value? Is it a 32bit unsigned int?

I suppose I could boot the roboclaw and let it home, then set the S3 mode to home/limit and drive it forward until it stops, read the encoder to get my full revolution count, and then switch it back to home mode. However, that's a lot of EEPROM writes. I could then either reset the encoder when I read a full revolution or divide by it to get my index and remainder.

Thank you for making such a great product! This really simplifies encoded motor control.
DaAwesomeP
Posts: 3
Joined: Thu Jul 11, 2019 11:53 am
Re: Trigger home or reset encoder on each pass

Post by DaAwesomeP »

If you are able to (I would really appreciate it), a "Home/Reset Encoder" option would be all that is needed. If the encoder is reset every time it passes home, that would do the trick. It isn't full indexing, but it would allow for positional control.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Trigger home or reset encoder on each pass

Post by Basicmicro Support »

Contact Support on Friday. I may have a pre-release you can test. No guarantees we can add anything though. We only have so much memory and have added a ton of new features over the years so there isn't much room left.

Post Reply