thingswebuilt / osod24_firmware

0 stars 0 forks source link

Allow us to set which end of the robot is considered the front #53

Closed markmellors closed 6 months ago

markmellors commented 7 months ago

This allows us to drive "backwards" (steereable wheels at the back) for the Ecodisaster challenge, without any other changes.

markmellors commented 7 months ago

I think its worth thinking about if I've made this flip in the best place. I was hoping it would only require a change in the navigator, then everything onwards in the chain would be the same. So, as coded in this PR, a request to go forward is received in the navigator, it could flip that to reverse if we're considering the back as the front, then the statemanager makes the robot to go in reverse. Unfortunately odometry (state_estimator) also needs to know the direction, either by offsetting the heading 180 degrees somewhere, or in how the X & Y estimates are updated. I think theres probably an alternative implementation where the navigator is the same for which ever direction we're going, and its the state_manager that changes. I'm not sure what would happen in that case with state_esitmator. maybe it would still need to change. I did it this way in case there's a dynamics difference between chassis forwards and chassis backwards, but I haven't thought the options through in that much detail.