Skip to content

Fix contact_thresh_neg value for the lift #22

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hello-chintan
Copy link

The lift contact_thresh_neg value is not respected when supplied with move_to, move_by command because for the lift a sane value for this argument would still be positive. However, in HelloController, the i_contact_neg value is always converted to a negative value by multiplying the absolute with -1. Hence, the guarded contact comparison for contact_thresh_neg always happens with a negative value at the controller level which for the lift is achieved only when a very high force is applied.

The fix in this PR gets rid of the extraneous operation with -1 as it’s not necessary if the user sets the contact_thresh_neg value with the correct sign.

@aedsinger
Copy link
Contributor

This is indeed a bug. However, the orginal intent was to safely handle the case when i_contact_neg > i_contact_pos. This would happen for motors that were setup up backwards. Checking the stretch_params it seems that it should be OK to make this change. However, I'd recommend modifying the firmware to set the the contact threshold to zero if this happens:

if (g_eff_pos<g_eff_neg){g_eff_pos=0;g_eff_neg=0;}

after line 820. Test the code to make sure this happens. Conversely, this could be handled at the Stretch Body level (with the advantage of error/warning reporting)

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