Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Serial Logger Documentation

Fraser Dougall edited this page Feb 18, 2022 · 6 revisions

Objective

Parse the packets being sent from the Arduino to the Jetson into human readable statements using the built in ROS logger to display the statements. The raw packets will be logged in hexadecimal form to a file, where it will then be parsed in a .cpp file, then logged via ROS. The output will consist of, depending on packet intention, steer angle, target velocity, cart slowing up or slowing down, execution time, and more.

Requirements

  • Print the packets in human readable form [steer angle, velocity, execution time]
  • Each log is dated from run time
  • Log will measure execution time of the command
  • Output will have different flags such as info, warning, error
  • The math of the CRC will be tracked using overflow addition
  • Look at past packets to see if the cart is changing speed

Structure of a Serial Packet:

Enable Case: (4 bytes): START_BYTE , ID_ENABLE , serial_crc , STOP_BYTE

Disable Case: (4 bytes): START_BYTE , ID_KILL , serial_crc , STOP_BYTE

Control Case: (6 bytes): START_BYTE , ID_CONTROL , data_len_buf , DATA_buf , serial_crc , STOP_BYTE

What DATA_buf is sending is based on data_len_buf 's size. Their state machine makes it so that we can send packets with either steering data; steering and throttle data; or steering throttle and braking data.

Software Architecture:

File location: /ti_comm/src/test/amp_serial_jetson_SERIAL_test.cpp

In amp_serial_jetson_build_packet() function

Using CPP's iostream, write the hexadecimal value of the packet contents to a text file line by line.

Example Packet Output (Enable Case): 02F0A203

Example Parse: "Enabled"

Example Packet Output (Control [Brake] Case): 02F1E24CA203

Example Parse: "Breaking with value 226 | CRC: [TODO: detail CRC math here]"