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

Implement configurable position offsets. #335

Merged
merged 3 commits into from
Dec 12, 2024

Conversation

danzimmerman
Copy link

@danzimmerman danzimmerman commented Nov 23, 2024

This PR adds the parameters offset_pos_to_dev and offset_pos_from_dev to bus.yml to allow user-defined offsets in the position feedback and commands. These default to zero if not specified.

One use case is remapping the sense of rotation and angle convention for a joint with an absolute angle encoder whose rotation direction cannot be reversed physically or electronically.

Assuming full-scale encoder count $n_{fs}$ and current count $n_{enc}$, mapping position feedback from the device, with offset_pos_from_dev = 2*pi, scale_pos_from_dev = -2*pi/n_fs:

$$\large \theta = 2\pi - \frac{2\pi}{n_{fs}}n_{enc}$$

Mapping commands to the device, with offset_pos_to_dev = n_fs, scale_pos_to_dev = -n_fs/(2*pi):

$$\large n_{enc} = n_{fs} - \frac{n_{fs}}{2\pi}\theta$$

This could also be useful for absolute position encoders that otherwise cannot be zeroed at a given physical position.

@danzimmerman
Copy link
Author

I fixed the formatting with the pre-commit hook. Sorry I missed that at first.

@danzimmerman
Copy link
Author

Also updated the CiA402 driver bus configuration docs to match.

@ipa-vsp ipa-vsp merged commit dec8f7f into ros-industrial:master Dec 12, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants