This driver uses Espressif's TWAI (Two-Wire Automotive Interface) in order to communicate with Xiamoi CyberGear motors. It bases on the library Xiaomi_CyberGear_Arduino and is ported for ESP-IDF.
This library does not use error logs/prints, but instead every internal error is
passed through. Therefore each relevant function returns esp_err_t, which should
be handled. During development ESP_ERROR_CHECK(...) helps, but due to the strength
of these motors, an error should be resolved or the motors should be stopped by an
external emergency mechanism.
Pay attention: The motor provides a list of faults. These are not tested yet and the code is beta. Following lists the faults and whether a fault was already correctly tested:
-
overload -
uncalibrated -
over_current_phase_a -
over_current_phase_b -
over_current_phase_c -
over_voltage -
under_voltage -
driver_chip -
over_temperature -
magnetic_code_failure -
hall_coded_faults
idf.py add-dependency "cybergear-robotics/cybergear"- create example project
idf.py create-project-from-example "cybergear-robotics/cybergear:position_test"- Go to to example directory (for example
position_test)cd position_test - Set ESP chip
idf.py set-target esp32 - Configure CAN TX/RX in menu
CyberGear Example.idf.py menuconfig - Build, flash
idf.py build flash monitor