Note: This tutorial assumes that you have completed the previous tutorials: ROS Tutorials. |
Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Energia IDE Setup
Description: This tutorial shows step-by-step instruction on how setting up Energia IDE.Tutorial Level: BEGINNER
Next Tutorial: TivaWare Setup
Contents
Introduction
Energia IDE is provided by TI with the goal of helping people use and program TI's Launchpad ecosystem of evaluation boards. Energia is based on Arduino IDE which will be familiar to an avid Arduino user.
The following steps are very similar to the ones required to setup 'rosserial_arduino'.
Only the following boards are compatible with rosserial_tivac:
- EK-TM4C123GXL
- EK-TM4C1294XL
With Energia IDE, only UART over the debug USB port is able to communicate with ROS.
Download and install Energia IDE
If you haven't already, you must download and install Energia IDE on your system.
Download and instructions: Energia IDE
Before continuing to the next steps, be certain you can compile and upload sketches to your boards.
Install rosserial_tivac
You can install rosserial_tivac from source, either using the remaining rosserial pacakges from debs or from source.
Follow one of the two options:
- rosserial_tivac from source + rosserial binaries
- rosserial_tivac + rosserial from source
rosserial_tivac from source + rosserial binaries
rosserial_tivac can be found on the repository: https://github.com/vmatos/rosserial_tivac
Make sure you have rosserial package installed, either from binaries or source.
Installing rosserial binaries
Example of how to install rosserial packages in binary form for Jade.
sudo apt-get install ros-jade-rosserial ros-jade-rosserial-msgs ros-jade-rosserial-client ros-jade-rosserial-python
Download and build rosserial_tivac
Navigate to your ROS workspace. Clone the git repository. Then build and install the package.
cd <workspace_dir>/src git clone https://github.com/vmatos/rosserial_tivac.git cd <workspace_dir> catkin_make catkin_make install
rosserial_tivac + rosserial from source
Make sure you don't have any rosserial to avoid conflicts between packages.
sudo apt-get remove ros-jade-rosserial ros-jade-rosserial-msgs ros-jade-rosserial-client ros-jade-rosserial-python
Download and build rosserial_tivac
Navigate to your ROS workspace. Clone the git repository. Then build and install the package.
cd <workspace_dir>/src git clone https://github.com/ros-drivers/rosserial.git cd <workspace_dir> catkin_make catkin_make install
Prepare rosserial libraries for Energia
Now you have to prepare the libraries required for Energia to compile sketches with ROS enabled communication.
Add the installed rosserial_tivac to path. Or add the command to .bashrc.
source <workspace_dir>/install/setup.bash
Navigate to your Energia sketches directory and prepare the libraries.
cd <sketches_dir> cd libraries rosrun rosserial_tivac make_libraries_energia .
This step should execute without any errors. You're now ready to test the demo sketches.
Test it up
Restart Energia IDE for it to find the new installed libraries. The installed libraries come with two examples.
chatter: publishes 'hello world!' message over and over.
rgb: subscribes to ColorRGBA message and changes LED color. Only for EK-TM4C123GXL board.
Uploading the example code
To upload the code to your Tiva C Launchpad, use the upload function within the IDE. This is no different from uploading any other sketch.
Running a published code
Now, launch the roscore in a new terminal window:
roscore
Next, run the rosserial client application that forwards your Launchpad messages to the rest of ROS. Make sure to use the correct serial port:
rosrun rosserial_python serial_node.py /dev/ttyUSB0
Finally, watch the greetings come in from your Launchpad by launching a new terminal window and entering :
rostopic echo chatter
Running a subscriber code
Stop the running hello world example and the rosserial message forwarder, upload the code to Launchpad and launch the message forwarder again:
rosrun rosserial_python serial_node.py /dev/ttyUSB0
Now, you can toggle the LED using rostopic:
rostopic pub led std_msgs/ColorRGBA "r: 0.0 g: 0.0 b: 1.0 a: 1.0"
The LED should turn blue. Change the r,g,b values between [0,1] and check the colors. The 'a' value corresponds to transparency which in this case means color intensity.
Next tutorials
If you wish to use Energia to develop your applications, you can simply follow the same tutorial as the Arduino ones, taking into account the board layout is different.