Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions lib/APPRemoteControl/src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -472,9 +473,10 @@ void App_currentVehicleChannelCallback(const uint8_t* payload, const uint8_t pay
{
const VehicleData* currentVehicleData = reinterpret_cast<const VehicleData*>(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
{
Expand Down
27 changes: 16 additions & 11 deletions lib/APPRemoteControl/src/SerialMuxChannels.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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
Expand Down
Loading