Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion between encoder HARP data and real units #80

Open
RoboDoig opened this issue Sep 25, 2024 · 10 comments
Open

Conversion between encoder HARP data and real units #80

RoboDoig opened this issue Sep 25, 2024 · 10 comments

Comments

@RoboDoig
Copy link
Collaborator

Need to understand how the encoder value from HARP H2 can be converted to a real-world angle.

@RoboDoig
Copy link
Collaborator Author

@RoboDoig
Copy link
Collaborator Author

Confirmed with @EleonoraAmbrad today, the signal from H2 comes from the decoded quadrature counts from the chip's integrated decoder. Datasheet for the encoder says 4000 counts per revolution, confirmed that the main shaft turns a complete revolution for every 4000 units in Bonsai.

To convert this to main platform angle we need to know effective gear ratio between main shaft and platform.

@RoboDoig
Copy link
Collaborator Author

RoboDoig commented Oct 1, 2024

Hi @ederancz, @EleonoraAmbrad - following our conversation on Monday, can I mark this issue as closed?

To clarify the main points from Monday:

  1. We have established that the gear ratio between the motor drive and the platform is 6:1
  2. We have established based on the encoder data sheet and a practical test that the encoder reports its values in counts, and there are 4000 counts per revolution.
  3. The motor driver is set to 6400 pulses per revolution. We established, by using the H2 feature that allows us to set an absolute pulse count, that 6400*6 (drive PPR * gear ration) pulses produces a full rotation of the platform.
  4. In closed loop mode we are writing immediate pulses (instantaneous pulse period) rather than an absolute count of pulses. One can estimate the pulse count (and therefore angle turn command) in postprocessing by analyzing the timestamped HARP write command on immediate pulses, and the time period between these write commands.

@ederancz
Copy link
Collaborator

ederancz commented Oct 2, 2024

Hi @EleonoraAmbrad , can you please get Iakov to check the encoder counts and motor pulses from the recording?
If memory serves, there was 1 full motor rotation (6400 pulses) followed by 2x1 full platform rotation (38400 pulses). So the encoder reading should be 4000 and 24000. If it adds up (±0.1%), you can close the issue.

@ikharitonov
Copy link
Collaborator

Hi @RoboDoig , has this recording been saved? We could not locate it with Nora

@RoboDoig
Copy link
Collaborator Author

RoboDoig commented Oct 3, 2024

Ah sorry I didn't fully parse the last message from @ederancz .

We did the test on a minimal debug workflow with no logging so nothing was recorded, we were just monitoring the visualizers.

@RoboDoig
Copy link
Collaborator Author

RoboDoig commented Oct 3, 2024

The workflow we used is called DirectPulsesTest.bonsai. It just writes the desired pulses (6400) to the motor driver on a key press. If you want to record you could just dump the H2 events to a binary file with MatrixWriter. Interpreting the encoder value should be straightforward. For the motor pulses, you will get a HARP timestamped event when the number of pulses is written (register 33) though you already know how many pulses were written as it's set in that workflow directly.

@EleonoraAmbrad
Copy link
Collaborator

I will do that on Monday together with the motion cloud test!

@RoboDoig
Copy link
Collaborator Author

@EleonoraAmbrad I updated DirectPulsesTest.bonsai to log data - in the ae-dev branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants