diff --git a/lib/APPRemoteControl/src/App.cpp b/lib/APPRemoteControl/src/App.cpp index 11393bf6..eeb6a0db 100644 --- a/lib/APPRemoteControl/src/App.cpp +++ b/lib/APPRemoteControl/src/App.cpp @@ -458,10 +458,11 @@ void App_lineSensorChannelCallback(const uint8_t* payload, const uint8_t payload } /** - * Receives current position and heading of the robot over SerialMuxProt channel. + * Receives current position, heading and IMU of the robot over SerialMuxProt channel. * - * @param[in] payload Current vehicle data. Two coordinates, one orientation and two motor speeds. - * @param[in] payloadSize Size of two coordinates, one orientation and two motor speeds. + * @param[in] payload Current vehicle data: Timestamp, two coordinates, one orientation, + * three motor speeds and raw IMU data (X acceleration, Z axis turn rate). + * @param[in] payloadSize The size of the received payload data. * @param[in] userData Instance of App class. */ void App_currentVehicleChannelCallback(const uint8_t* payload, const uint8_t payloadSize, void* userData) @@ -472,9 +473,10 @@ void App_currentVehicleChannelCallback(const uint8_t* payload, const uint8_t pay { const VehicleData* currentVehicleData = reinterpret_cast(payload); - LOG_DEBUG("X: %d Y: %d Heading: %d Left: %d Right: %d Center: %d", currentVehicleData->xPos, - currentVehicleData->yPos, currentVehicleData->orientation, currentVehicleData->left, - currentVehicleData->right, currentVehicleData->center); + LOG_DEBUG("Timestamp: %d X: %d Y: %d Heading: %d Left: %d Right: %d Center: %d AccX: %d TurnZ: %d ", + currentVehicleData->timestamp, currentVehicleData->xPos, currentVehicleData->yPos, + currentVehicleData->orientation, currentVehicleData->left, currentVehicleData->right, + currentVehicleData->center, currentVehicleData->accelerationX, currentVehicleData->turnRateZ); } else { diff --git a/lib/APPRemoteControl/src/SerialMuxChannels.h b/lib/APPRemoteControl/src/SerialMuxChannels.h index 8d68654f..ab647243 100644 --- a/lib/APPRemoteControl/src/SerialMuxChannels.h +++ b/lib/APPRemoteControl/src/SerialMuxChannels.h @@ -186,8 +186,9 @@ typedef struct _CommandResponse }; } __attribute__((packed)) CommandResponse; -static_assert(sizeof(CommandResponse) <= MAX_DATA_LEN, - "CommandResponse struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame."); +static_assert( + sizeof(CommandResponse) <= MAX_DATA_LEN, + "CommandResponse struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame."); /** Struct of the "Motor Speed Setpoints" channel payload. */ typedef struct _MotorSpeed @@ -212,13 +213,16 @@ static_assert(sizeof(RobotSpeed) <= MAX_DATA_LEN, /** Struct of the "Current Vehicle Data" channel payload. */ typedef struct _VehicleData { - int32_t xPos; /**< X position [mm]. */ - int32_t yPos; /**< Y position [mm]. */ - int32_t orientation; /**< Orientation [mrad]. */ - int32_t left; /**< Left motor speed [mm/s]. */ - int32_t right; /**< Right motor speed [mm/s]. */ - int32_t center; /**< Center speed [mm/s]. */ - SMPChannelPayload::Range proximity; /**< Range at which object is found [range]. */ + uint32_t timestamp; /**< Timestamp [ms]. */ + int32_t xPos; /**< X position [mm]. */ + int32_t yPos; /**< Y position [mm]. */ + int32_t orientation; /**< Orientation [mrad]. */ + int32_t left; /**< Left motor speed [mm/s]. */ + int32_t right; /**< Right motor speed [mm/s]. */ + int32_t center; /**< Center speed [mm/s]. */ + SMPChannelPayload::Range proximity; /**< Range at which object is found [range]. */ + int16_t accelerationX; /**< Raw acceleration in X [digit]. */ + int16_t turnRateZ; /**< Raw turn rate around Z [digit]. */ } __attribute__((packed)) VehicleData; static_assert(sizeof(VehicleData) <= MAX_DATA_LEN, @@ -239,8 +243,9 @@ typedef struct _LineSensorData uint16_t lineSensorData[5U]; /**< Line sensor data [digits] normalized to max 1000 digits. */ } __attribute__((packed)) LineSensorData; -static_assert(sizeof(LineSensorData) <= MAX_DATA_LEN, - "LineSensorData struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame."); +static_assert( + sizeof(LineSensorData) <= MAX_DATA_LEN, + "LineSensorData struct size must be less than or equal to MAX_DATA_LEN to fit in the SerialMuxProt frame."); /****************************************************************************** * Functions