Skip to content

Arduino_Communications

Matt Pedler edited this page Aug 30, 2016 · 1 revision

This Page covers the different functions in the Arduino Communications folder

General Overview

This program collects the depth and killswitch messages over i2c from the arduino and publishes them to their respective topics

Classes

  • ArdI2C
    • This class deals with messages coming over from i2c
  • ArdComm
    • This class used to deal with Serial communications from the Arduino
    • This class now is only used for its function "interperet_message"

Class functions and descriptions

ArdI2c

ArdI2C() - This is a constructor used to initialize class values

init() - This is an empty function but kept just in case a use becomes available

ardWrite(double imu_data[3]) - This function writes the current YPR to the arduino over I2C at the appropriate registries

ardRead() - This function reads all registries from the arduino. The function then packages the data into a string and returns that string.

update_desired and pid_Set - These functions are outdated and set to be removed

ArdComm

ArdComm() - Constructor used to initialize class values

listen() - function for listening to a serial stream

init() - used to determine the serial port for the arduino

interperet_message(string message) - This function takes the message from the arduino then parses the statement.A standard statement is M0:123.235;M4:544.23523;M1:665; this function will break apart this statement into their respected values. the individual statements are broken up by the ";" delimiter

pathExists(const std::string& name) - Function used to determine if path on the current system exists

trim(string& str) - used to chop any whitespace from a string

Clone this wiki locally