Flashing Chefbot firmware using Energia IDE

After developing the preceding connections, we can program the Launchpad using Energia IDE (http://energia.nu/). After setting Energia IDE on the PC (Ubuntu is preferred), we can flash the robot firmware to the board. We will get the firmware code and the ROS interface package by using the following command:

    $ git clone https://github.com/qboticslabs/Chefbot_ROS_pkg

The folder contains a folder called tiva_c_energia_code, which has the firmware code that flashes to the board after compilation in Energia IDE.

The firmware can read the encoder, ultrasonic sensor, and IMU values, and can receive values of the motor velocity command.

The important section of the firmware is discussed here. The programming language in the LaunchPad is the same as Arduino. Here we are using Energia IDE to program the controller, which is built from Arduino IDE.

The following code snippet is the setup() function definition of the code. This function starts serial communication with a baud rate of 115200. It also configures pins of motor encoder, motor driver pins, ultrasonic distance sensor, and IMU.
Also, through this code, we are configuring a pin to reset the LaunchPad.

void setup() 
{ 
   
  //Init Serial port with 115200 baud rate 
  Serial.begin(115200);   
   
  //Setup Encoders 
  SetupEncoders(); 
  //Setup Motors 
  SetupMotors(); 
  //Setup Ultrasonic 
  SetupUltrasonic();   
  //Setup MPU 6050 
  Setup_MPU6050(); 
  //Setup Reset pins 
  SetupReset(); 
  //Set up Messenger  
  Messenger_Handler.attach(OnMssageCompleted); 
  }

In the loop() function, the sensor values are continuously polled and the data is sent through serial port and incoming serial data are continuously polled for getting the robot commands. The following convention protocols are used to send each sensor value from the LaunchPad to the PC using serial communication (UART).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.36.133