Help understanding the code flow within the Alvik libraries

I'm attempting to learn more about the Arduino Alvik codebase. Specifically, I'm trying to trace the code that executes when calling a drive() command, all the way to where the individual motors speeds are updated to make the bot drive. My current understanding is that: - The Arduino Alvik (https://github.com/arduino-libraries/Arduino_Alvik/tree/main) is the primary Arduino library that is utilized within custom sketches to run on the Nano ESP32. - The Arduino Alvik Carrier (https://github.com/arduino-libraries/Arduino_AlvikCarrier/tree/main) is the firmware code that runs on the STM32 - The Arduino Alvik library contains a high-level API with functions like drive() and move() that users can call in their sketches on the NanoESP32, and the low-level control of the motors is handed by the Arduino Alvik Carrier codeon the STM32 I'm trying to identify where the interaction is happening between the NanoESP32 and the STM32.
GitHub
GitHub - arduino-libraries/Arduino_Alvik: Library to drive Alvik robot
Library to drive Alvik robot. Contribute to arduino-libraries/Arduino_Alvik development by creating an account on GitHub.
GitHub
GitHub - arduino-libraries/Arduino_AlvikCarrier
Contribute to arduino-libraries/Arduino_AlvikCarrier development by creating an account on GitHub.
1 Reply
BobHammell
BobHammellOP7mo ago
For example, this is the code that is executed for the drive() function: void Arduino_Alvik::drive(const float linear, const float angular, const uint8_t linear_unit, const uint8_t angular_unit){ if (angular_unit == PERCENTAGE){ converted_angular = (angular/ROBOT_MAX_DEG_S)*100.0; } else{ converted_angular = convert_rotational_speed(angular, angular_unit, DEG_S); } msg_size = packeter->packetC2F('V', convert_speed(linear, linear_unit, MM_S), converted_angular); uart->write(packeter->msg, msg_size); } Here linear and angular values are converted and written in a serial message over UART. I'd expect this UART communication to be sent to the STM32, where it would read and parsed, to be used in the low-level motor control . However, I can't located where that may be happeing. Instead, it looks like the reading and parsing (read_message() & parse_message()) is happening in the Arduino Alvik library itself, running on the NanoESP32. The parsing of this drive message does the following: case 'v': while (!xSemaphoreTake(robot_vel_semaphore, 5)){} packeter->unpacketC2F(code, robot_velocity[0], robot_velocity[1]); xSemaphoreGive(robot_vel_semaphore); break; Here the robot_velocity array values are updated with the linear and angular velocities. So I'm still missing how these values are passed down further to the STM32 in order to control the motors.

Did you find this page helpful?