open-dynamic-robot-initiative / master-board

Hardware and Firmware of the Solo Quadruped Master Board
BSD 2-Clause "Simplified" License
119 stars 41 forks source link

Add parse sensor data #99

Closed paLeziart closed 3 years ago

paLeziart commented 3 years ago

Description

When using a fast computer, checks inside HasError can be made before any packet has been received because the code runs too fast. As a result, values returned by the interface are still in their initial undefined state. This results in motor positions being infinite which triggers a position limit error or the error_code of the driver not being defined which triggers driver error security (error code equal to 208863232 for instance).

A call to ParseSensorData has been added at the end of the initialization function of the MasterBoardInterface. It initializes the interface values, either to 0 if no packet has been received yet or to decoded values if a packet has been received. That way if the code runs too fast all values will be 0 instead of infinite or random.

How I Tested

I ran a calibration procedure both in C++ and in Python by using the bindings. The calibration was successful in both cases and without error messages.

I fulfilled the following requirements

jviereck commented 3 years ago

Thanks for finding this issue and your contribution!