Edit on GitHub

OpenCR1.0 Software Setup

Warning : The contents in this chapter corresponds to the Remote PC (your desktop or laptop PC) which will control TurtleBot3. Do NOT apply this instruction to your TurtleBot3.

Note : OpenCR1.0 is pre-loaded with the software needed to run your specific TurtleBot3 model(Burger or Waffle). Refer to the information below only if you want to modify the existing software or write new software for OpenCR1.0.

Note : This instruction was tested on Ubuntu 16.04 and ROS Kinetic Kame and OpenCR1.0 software setup can be done from Intel® Joule™.

OpenCR1.0 controls DYNAMIXELs with instructions from the SBC. To be able to control DYNAMIXELs, a specific firmware should be installed on the board. See the descriptions and configure the settings.

ArduinoIDE Settings for OpenCR1.0

Following instructions will setup OpenCR1.0 Arduino development environment on the Remote PC.

USB Port Settings

Tip : The terminal application can be found with the Ubuntu search icon on the top left corner of the screen. Shortcut key for terminal is Ctrl-Alt-T.

[Remote PC] The following commands allow to use OpenCR1.0 USB port for uploading Arduino IDE program without acquiring root permission.

  wget https://raw.githubusercontent.com/ROBOTIS-GIT/OpenCR/master/99-opencr-cdc.rules
  sudo cp ./99-opencr-cdc.rules /etc/udev/rules.d/
  sudo udevadm control --reload-rules
  sudo udevadm trigger

Compiler Settings

[Remote PC] OpenCR1.0 libraries are designed for 32-bit platform, therefore, 64-bit PC requires 32-bit compiler for Arduino IDE.

  sudo apt-get install libncurses5-dev:i386

Install Arduino IDE

[Remote PC] Download the latest version of Arduino IDE from official Arduino homepage and install the program. OpenCR1.0 supports Arduino IDE 1.6.12 or later (OpenCR1.0 has also been tested with Arduino IDE 1.8.1.).

https://www.arduino.cc/en/Main/Software

[Remote PC] Extract downloaded file to desired folder and execute the install file in the folder from the terminal. The below example uses tools folder in the root directory (~/). This folder will act as Arduino IDE folder.

  cd ~/tools/arduino-1.8.1
  ./install.sh

[Remote PC] Open the script file with below command.

  gedit ~/.bashrc

[Remote PC] Append below Arduino IDE path information at the end of the bashrc file. It is recommended to use gedit editor. (Use another editor if necessary)

  export PATH=$PATH:$HOME/tools/arduino-1.8.1

[Remote PC] Last but not least, source the bashrc file to apply changes.

  source ~/.bashrc

Run Arduino IDE

[Remote PC] In order to run Arduino IDE on Linux platform, enter below command on the terminal.

  arduino

[Remote PC] If the program is installed and configured correctly, you’ll be able to see GUI program as below.

Porting OpenCR1.0 to Arduino IDE

Preferences

[Remote PC] When Arduino IDE is running, go to FilePreferences from the menu of the program. When the Preferences window appears, copy and paste following link to the Additional Boards Manager URLs textbox. (This step may take about 20 min.)

  https://raw.githubusercontent.com/ROBOTIS-GIT/OpenCR/master/arduino/opencr_release/package_opencr_index.json

Install OpenCR1.0 Package from Boards Manager

[Remote PC] Go to ToolsBoardBoards Manager.

[Remote PC] Type OpenCR into the textbox to find the OpenCR by ROBOTIS package. If the package is found, click Install.

[Remote PC] When the package installation is completed, INSTALLED text will be appeared next to the package name.

[Remote PC] See if OpenCR Board is now in the list of ToolsBoard. Select OpenCR Board to import OpenCR Board source.

Port Setting

[Remote PC] This section shows how to setup the USB port for program upload. OpenCR1.0 should be connected to the PC with the USB port.   [Remote PC] Select ToolsPort/dev/ttyACM0.

Warning : The last digit value 0 in the string /dev/ttyACM0 might be different depend on the USB connection environment.

Writing Bootloader (can be skipped)

Note : This section is not necessary until there is new updates in the OpenCR bootloader. Once the bootloader is burned on the board, IT DOESN’T NEED EXTRA BURNING.

The STM32F7xx, which is used for the main MCU of OpenCR1.0, supports DFU(Device Firmware Upgrade). This enables built-in bootloader of the MCU to boot with the DFU protocol by using USB, primarily for the bootloader initialization, the recovery mode and the bootloader update. The biggest advantage of using bootloader with USB is that JTAG equipment is not required. Therefore, writing the new firmware by using the DFU mode which is embedded in the MCU will not require writing / debugging equipment such as STLink.

Programmer Setting

[Remote PC] Go to ToolsDFU-UTIL

Entering the DFU Mode

[Remote PC] Press Boot button at first, then press Reset button after few seconds while Boot button is pressed. Keeping Boot button pressed, release Reset button at second. Finally, release Boot button slowly. This enables user to activate the DFU mode.

[Remote PC] If you successfully entered to DFU mode, you will be able to find STMicroelectronics STM Device in DFU Mode text string when lsusb is entered in the terminal.

Download the Bootloader

[Remote PC] Go to ToolsBurn Bootloader to download the bootloader.

[Remote PC] When download is completed, press Reset button again.

OpenCR1.0 Firmware Settings for ROS

Add TurtleBot3 Firmware to OpenCR1.0

OpenCR1.0 firmware (or the source) for ROS is to control DYNAMIXEL and sensors in the ROS. The firmware is located in OpenCR example which is downloaded by the board manager. If you have TurtleBot3 Burger,

[Remote PC] Go to FileExamplesturtlebot3turtlebot3_burgerturtlebot3_core.

If you have TurtleBot3 Waffle,

[Remote PC] Go to FileExamplesturtlebot3turtlebot3_waffleturtlebot3_core.

[Remote PC] Click Upload button to upload the firmware to OpenCR1.0.

Note : If error occurs while uploading firmware, go to ToolsPort and check if correct port is selected. Press Reset button on the OpenCR1.0 and try to upload the firmware again.

[Remote PC] When firmware upload is completed, jump_to_fw text string will be printed on the screen.