Skip to content

Fix: Right hand reset_motors.py integer underflow issue#2

Open
kywch wants to merge 2 commits intoruka-hand:mainfrom
kywch:main
Open

Fix: Right hand reset_motors.py integer underflow issue#2
kywch wants to merge 2 commits intoruka-hand:mainfrom
kywch:main

Conversation

@kywch
Copy link

@kywch kywch commented Jun 3, 2025

Thank you for making the RUKA hand!

When using reset_motors.py with the right hand, the hand's self.tensioned_pos was set to 0. It caused integer underflow, resulting in erratic motor positions with large values like 4294967295.

curr_pos: [101, 100, 100, 101, 101, 98, 99, 98, 101, 101, 101], des_pos: [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
curr_pos: [0, 1, 0, 3, 3, 0, 1, 2, 1, 2, 2], des_pos: [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
curr_pos: [0, 0, 0, 2, 1, 0, 1, 4294967295, 1, 2, 2], des_pos: [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
curr_pos: [0, 0, 0, 1, 1, 0, 1, 4294967273, 1, 4294967295, 4294967295], des_pos: [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
curr_pos: [0, 0, 0, 1, 1, 0, 1, 4294967250, 0, 4294967258, 4294967286], des_pos: [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
curr_pos: [0, 0, 0, 1, 0, 0, 1, 4294967261, 1, 44, 21], des_pos: [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
curr_pos: [0, 0, 0, 1, 4294967295, 0, 1, 4294967265, 1, 41, 28], des_pos: [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
curr_pos: [0, 0, 0, 1, 4294967170, 0, 1, 4294967263, 1, 13, 12], des_pos: [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
curr_pos: [0, 0, 0, 1, 4294967174, 0, 1, 4294967292, 1, 5, 6], des_pos: [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
curr_pos: [0, 0, 0, 1, 4294967191, 0, 1, 4294967263, 1, 3, 3], des_pos: [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
curr_pos: [0, 0, 0, 1, 4294967201, 0, 1, 4294967262, 1, 2, 3], des_pos: [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
...

Adding 100 to self.tensioned_pos fixed it and produced the output like:

curr_pos: [100, 100, 100, 101, 98, 101, 101, 100, 101, 101, 101], des_pos: [100. 100. 100. 100. 100. 100. 100. 100. 100. 100. 100.]
curr_pos: [100, 100, 100, 101, 99, 101, 101, 100, 101, 101, 101], des_pos: [100. 100. 100. 100. 100. 100. 100. 100. 100. 100. 100.]
curr_pos: [100, 100, 100, 101, 99, 101, 101, 100, 101, 101, 101], des_pos: [100. 100. 100. 100. 100. 100. 100. 100. 100. 100. 100.]
curr_pos: [100, 100, 100, 101, 100, 101, 101, 100, 101, 101, 101], des_pos: [100. 100. 100. 100. 100. 100. 100. 100. 100. 100. 100.]
curr_pos: [100, 100, 100, 101, 101, 101, 101, 100, 101, 101, 101], des_pos: [100. 100. 100. 100. 100. 100. 100. 100. 100. 100. 100.]
curr_pos: [100, 100, 100, 101, 101, 101, 101, 100, 101, 101, 101], des_pos: [100. 100. 100. 100. 100. 100. 100. 100. 100. 100. 100.]
curr_pos: [100, 100, 100, 101, 101, 101, 101, 100, 101, 101, 101], des_pos: [100. 100. 100. 100. 100. 100. 100. 100. 100. 100. 100.]
curr_pos: [100, 100, 100, 101, 101, 101, 101, 100, 101, 101, 101], des_pos: [100. 100. 100. 100. 100. 100. 100. 100. 100. 100. 100.]
...

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.

1 participant