<listOptionValue builtIn="false" value="../Core/Inc"/>
<listOptionValue builtIn="false" value="../Drivers/STM32F7xx_HAL_Driver/Inc"/>
<listOptionValue builtIn="false" value="../Drivers/STM32F7xx_HAL_Driver/Inc/Legacy"/>
+ <listOptionValue builtIn="false" value="../Core/Inc/protobuf"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.otherflags.978301265" name="Other flags" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.otherflags" useByScannerDiscovery="false" valueType="stringList"/>
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.1784720711" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c"/>
<listOptionValue builtIn="false" value="../Core/Inc"/>
<listOptionValue builtIn="false" value="../Drivers/STM32F7xx_HAL_Driver/Inc"/>
<listOptionValue builtIn="false" value="../Drivers/STM32F7xx_HAL_Driver/Inc/Legacy"/>
+ <listOptionValue builtIn="false" value="../Core/Inc/protobuf"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.definedsymbols.1826209638" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
+++ /dev/null
-// __attribute__((packed)) -> no padding bytes
-typedef struct __attribute__((packed)) {
- float angular_velocity;
- float linear_velocity;
- float delta_time;
-} odometry_msg;
-
-typedef struct __attribute__((packed)) {
- float linear_velocity;
- float angular_velocity;
-} velocity_msg;
-
-typedef struct __attribute__((packed)) {
- float pid_select;
- float pid_setpoint_fixed;
- float pid_setpoint_lin;
- float pid_setpoint_ang;
- float pid_kp;
- float pid_ki;
- float pid_kd;
-} pid_setup_msg;
-
-typedef struct __attribute__((packed)) {
- float velocity;
-// float millis;
-} plot_msg;
-
-typedef struct __attribute__((packed)){
- int left_ticks;
- int right_ticks;
-} ticks_msg;
-
-typedef struct __attribute__((packed)){
- float left_vel;
- float right_vel;
-} wheel_msg;
-
/* Private includes ----------------------------------------------------------*/\r
/* USER CODE BEGIN Includes */\r
\r
-#include "encoder.h"\r
-#include "odometry.h"\r
-#include "motor_controller.h"\r
-#include "pid.h"\r
-#include "communication_utils.h"\r
+#include "control/encoder.h"\r
+#include "control/odometry.h"\r
+#include "control/motor_controller.h"\r
+#include "control/pid.h"\r
\r
-#include "pb_encode.h"\r
-#include "pb_decode.h"\r
-#include "otto_communication.pb.h"\r
+#include "protobuf/otto_communication.pb.h"\r
+#include "protobuf/pb_encode.h"\r
+#include "protobuf/pb_decode.h"\r
\r
/* USER CODE END Includes */\r
\r
&htim4, TIM_CHANNEL_3);\r
\r
//Communication\r
-uint8_t *tx_buffer;\r
-uint8_t *rx_buffer;\r
-\r
-velocity_msg vel_msg;\r
-wheel_msg wheels_msg;\r
-\r
int mode = 0; //setup mode\r
\r
uint8_t proto_buffer_rx[50];\r
bool tx_status;\r
float previous_tx_millis;\r
\r
-//TEST variables\r
-long start_time;\r
-long end_time;\r
-int time_diff;\r
-\r
/* USER CODE END PV */\r
\r
/* Private function prototypes -----------------------------------------------*/\r
left_motor.coast();\r
right_motor.coast();\r
\r
- tx_buffer = (uint8_t*) &wheels_msg;\r
- rx_buffer = (uint8_t*) &vel_msg;\r
-\r
- //proto stuff\r
-\r
+ //protobuffer messages init\r
vel_cmd = VelocityCommand_init_zero;\r
status_msg = StatusMessage_init_zero;\r
\r
}\r
\r
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *UartHandle) {\r
-\r
- start_time = HAL_GetTick();\r
-\r
// size_t buffer_size = sizeof(proto_buffer_rx);\r
// uint8_t buffer_copy[buffer_size];\r
// memcpy((void *) &buffer_copy, &proto_buffer_rx, buffer_size);\r
\r
HAL_UART_Receive_DMA(&huart6, (uint8_t*) &proto_buffer_rx,\r
VelocityCommand_size);\r
-\r
- end_time = HAL_GetTick();\r
- time_diff = end_time - start_time;\r
}\r
\r
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {\r
HAL_TIM_Base_Start_IT(&htim3);\r
\r
}\r
-\r
}\r
}\r
/* USER CODE END 4 */\r