Note1: The steps below are for ROS Kinetic installed on Ubuntu Xenial (16.xx). To install ROS Kinetic follow this.
Due credits to https://github.com/badrobot15/firebird_ros for the inspiration and base codes.
sudo apt-get update
sudo apt-get install arduino arduino-core
sudo usermod -a -G dialout your_user_here
arduino
- Open the Arduino IDE and go to Tools->Boards. You will see a board for AtMega 2560. However, this board is set at F_CPU (cpu frequency) of 16MHz but the frequency of mega chip on Firebird robot is set to 14.7456MHz. Thus we need to create a new board configuration for the required frequency, in order to compile arduino sketches for Firebird V robot.
- The new board configuration is required to be appended to boards.text file which can be found by following the steps below:
- Select an Arduino AVR Boards board from the Tools > Board menu.
- File > Examples > EEPROM > eeprom_clear
- Sketch > Show Sketch Folder
- Move up 4 folder levels and you will reach the location of boards.txt for the active version of Arduino AVR Boards.
- Open the boards.txt file using your favourite text editor and append this to the file. Save it then.:
firebird.name=Firebird V Mega 2560 Robot
firebird.vid.0=0x2341
firebird.pid.0=0x0010
firebird.vid.1=0x2341
firebird.pid.1=0x0042
firebird.vid.2=0x2A03
firebird.pid.2=0x0010
firebird.vid.3=0x2A03
firebird.pid.3=0x0042
firebird.vid.4=0x2341
firebird.pid.4=0x0210
firebird.vid.5=0x2341
firebird.pid.5=0x0242
firebird.upload.tool=avrdude
firebird.upload.maximum_data_size=8192
firebird.bootloader.tool=avrdude
firebird.bootloader.low_fuses=0xFF
firebird.bootloader.unlock_bits=0x3F
firebird.bootloader.lock_bits=0x0F
firebird.build.f_cpu=14745600L
firebird.build.core=arduino
firebird.build.variant=mega
# default board may be overridden by the cpu menu
firebird.build.board=AVR_MEGA2560
## Arduino/Genuino Mega w/ ATmega2560
## -------------------------
firebird.menu.cpu.atmega2560=ATmega2560 (Mega 2560)
firebird.menu.cpu.atmega2560.upload.protocol=wiring
firebird.menu.cpu.atmega2560.upload.maximum_size=253952
firebird.menu.cpu.atmega2560.upload.speed=115200
firebird.menu.cpu.atmega2560.bootloader.high_fuses=0xD8
firebird.menu.cpu.atmega2560.bootloader.extended_fuses=0xFD
firebird.menu.cpu.atmega2560.bootloader.file=stk500v2/stk500boot_v2_mega2560.hex
firebird.menu.cpu.atmega2560.build.mcu=atmega2560
firebird.menu.cpu.atmega2560.build.board=AVR_MEGA2560
- That's it! Close the IDE and open it again. You will be able to select your new board with name as Firebird V Mega 2560 Robot. You will be able to see the same as shown below:
- Put the folder FirebirdV/* found here into your
~/sketchbook/libraries/
AND~/Downloads/arduino-xxx
folder (for safe side copy into both the folders). Close the IDE and open it again to see the examples under FirebirdV.
sudo apt-get install ros-kinetic-rosserial-arduino
sudo apt-get install ros-kinetic-rosserial
cd ~/Downloads/
git clone https://github.com/tushar-semwal/firebirdv-ros-package.git
cd firebirdv-ros-package
cp -r firebird_v/ ~/<catkin_ws>/src/
cd ~/<catkin_ws>
source devel/setup.bash
- Go to the arduino sketchbook/libraries folder
cd ~/sketchbook/libraries
- If not found, create one using
mkdir ~/sketchbook/libraries
and executecd ~/sketchbook/libraries
- Execute this command inside the sketchbook/libraries folder:
rosrun rosserial_arduino make_libraries.py .
- Note there is a DOT (.) after make_library.py in the above command.
- Close and reopen the Arduino IDE and check the Files->Examples->ros_lib. If you can see it, congrats you have installed both ros_lib and FirebirdV libraries together.
Note2: If you want to edit Arduino files in Windows, then you can just copy the
ros_lib
folder from the Ubuntu to theC:\Program Files (x86)\Arduino\hardware\arduino\avr\
or<INSTALLED_FOLDER>\Arduino\hardware\arduino\avr\
in your Windows OS.
Since we are using XBee for communication between the PC and FIrebird robot, make sure to follow this tutorial.
- Open Arduino IDE and open the Examples->firebird_v->ROS_FBV example file. You can also get the .ino file from here.
- Click on Sketch->Export compile binary. May ask you to save at some location. Please do the same.
- Click Sketch->Show sketch folder.
- Burn the
ROS_FB.ino.mega.hex
file into your Firebird V robot using avrdude or any other tool.
roslaunch firebird_v firebird_v.launch
A video of robot behavior is shown below:
You should expect your robot to do following things sequentially:
- Buzzer on for 4 seconds.
- Buzzer off for 4 seconds.
- Bargraph LED displaying values from 1 to 255.
- Bargraph LED set to 0 (all leds off).
- LCD screen displaying "Hello".
- LCD screen finally displays "Done".
That's it done.
- cmd_vel topic and publish