The firmware for robì Nucleo board, used to read data from the IMU, send velocities commands to the wheels, and read actual wheel velocities.

Dependencies:   X_NUCLEO_IKS01A1

Robì board


Firmware overview

The goals of this firmware are:

  • read data from the IMU (the blue shield installed on the ), and send them through ethernet to the PC mounted on Robì
  • receive via ethernet the target velocity of the robot, calculate the required wheels velocities, and send them to the 4 wheels via CAN
  • receive via CAN the actual speeds of the wheels, calculate from them the actual robot velocities, and send it to the PC via ethernet.

For sending and receiving data through ethernet, on the board two UDP sockets are opened, one for outbound communication, and one for inbound communication. A serial communication is also set, that communicates with the PC through the same micro USB cable used to power the Nucleo board, and only trasmits debug info.
The only files you should need to edit/read are main.cpp, with the business logic, and param_config.h file, where you can consult or edit some firmware settings: IP&port for the UDP sockets, size of UDP packet, baudrate of the serial port.

Board setup

The blue shield with the IMU (X-NUCLEO-IKS01A1) must be placed in the connector on the board, the ethernet cable connected to the PC, the micro USB connected to the PC for power supply and debug. NOTE: two micro USB connectors exist, the correct one is the one on the opposite side of the board with respect to the ethernet connector, and not the one adjacent the ethernet connector.

On desktop side, the communication with the board is executed via ROS nodes, that you can find in this repo.

Actual functionalities

This firmware is still very raw, since I only had time to take steps for the implementation of the communication, and not on the logic. As a suggestion, read carefully the current code (it's only 140 LOC), and use it as an example of how the involved parts are going to communicate, rather than a simplified version of the final firmware.

Some final notes

  • learn the structure of the CAN messages to understand the prepareCANMessages procedure
  • for CAN communication you need to connect a CAN transceiver to PD0 and PD1 pins (make reference to this image)
  • the board currently sends raw data from the IMU, and the correction of the IMU bias/distortion is made in the ROS node that receive the data.

Jånzo

Revision:
13:04fa45b2bee1
Parent:
3:8a744d554a2f
--- a/X_NUCLEO_IKS01A1.lib	Thu Mar 01 00:36:42 2018 +0000
+++ b/X_NUCLEO_IKS01A1.lib	Fri May 11 08:04:59 2018 +0000
@@ -1,1 +1,1 @@
-http://os.mbed.com/teams/ST/code/X_NUCLEO_IKS01A1/#4b0acb55c62e
+https://os.mbed.com/users/giovanniberi93/code/X_NUCLEO_IKS01A1/#4b0acb55c62e