Husarion Docs
  • Tutorials
  • Manuals
  • Software
  • Downloads
  • Community

›Tutorials

Tutorials

  • About tutorials
  • How to start

    • 1. CORE2 - quick start
    • 2. ROSbot - quick start

    Mbed framework

    • 1. Enviroment configuration

    ROS tutorials

    • 1. ROS introduction
    • 2. Creating nodes
    • 3. Simple kinematics for mobile robot
    • 4. Visual object recognition
    • 5. Running ROS on multiple machines
    • 6. SLAM navigation
    • 7. Path planning
    • 8. Unknown environment exploration
    • 9. Map navigation

    ROS Projects

    • 1. Security guard robot
    • 2. Control virtual robot from your PC
    • 3. Using frontier exploration
    • 4. Object search
    • 5. Control robot by voice commands

    ROSbot 2.0 + ROSDS LIVE-Class

    • 1. Make Your Robot Patrol An Area

    AWS RoboMaker + ROSbot 2.0

    • 1. ROSbot + AWS Robomaker - Quick start tutorial
    • 2. Run ROS tutorials using AWS RoboMaker
    • 3. Run ROS on multiple machines with AWS RoboMaker
    • 4. ROSbot + AWS Robomaker - ROS2 Example Applications

    Other tutorials

    • 1. ROSbot + ROSDS Quick Start
    • 2. Using Cyclone DDS with Husarnet on ROS2
    • 3. ROSbot with WS2812B LEDs signalization

    Deprecated

    • 1. hFramework library development
    • 2. Offline development tools
    • 3. How to use CORE2-ROS local serial offline
    • 4. Using CORE2 to publish ROS topics through USB

CORE2 - quick start

Preparing hardware

Connect your CORE2 to a DC power supply. The power connector is a standard DC 5.5/2.1 (center-positive), and provides 6 to 16V output. You can use:

  • DC adapter
  • Li-poly/Li-ion packages - 2S or 3S (e.g. 18650 batteries)
  • AA alkaline batteries (4-10 pieces)

Set the power switch to "ON" position and now your device is ready to use!

First Steps

In this tutorial we will show you how to flash mbed applications on CORE2 using Husarion tools. Let's hack!

Hardware

  • CORE2 or CORE2-ROS (with SBC)
  • USB A <-> USB micro cable

Software prerequisites:

Before we start make sure you already downloaded:

  • Husarion tools
  • Hex file with example compiled code

We will explain how to use it in next steps of this tutorial

First flashing

The code

Take a minute to analyze the program below. We provided you with comments to make it easier.

#include <mbed.h>

static const uint8_t led_mask[] = {
0,0b00000001,0b00000010,0b00000100,0b00000010,
0b00000001,0,0b00000111,0b00000101,0b00000010};
BusOut leds(LED1,LED2,LED3);

int main()
{
    int k = sizeof(led_mask), n = 0;
    while(1)
    {
        leds = led_mask[n%k];
        n++;
        ThisThread::sleep_for(1000);
    }
}

The sample code is very simple. It instantiates a BusOut object that controls multiple GPIOs regardless of ports they belong to. On-board LEDs blink in order described by leds_mask array at the interval introduced by function ThisThread::sleep_for(1000).

The flashing

Before we start extract file husarion-tools.zip which contain few versions of core2-flasher script for different operating system and processor architecture. For example when you use Ubuntu x64 you have use amd64-linux version.

Now let's plug in micro USB cable to USB hSerial port and to your computer.

Open console and run core2-flasher using our example.hex:

.<directory>/core2-flasher <directory>/example.hex

for example:

./Desktop/husarion-tools/amd64-linux/core2-flasher ~/Desktop/example.hex

Everything went OK, if you will see output similar to this:

Checking the results

If LEDs start blinking like on the animation below then congratulations! You've just successfully flashed your first Mbed application for CORE2!

Summary

After completing this tutorial you should know how to connect CORE2 to your computer and flash code.

You can go now to next tutorial named Configuration of environment for Mbed to find information how to write and compile your own code based on Mbed.


by Hubert Zwiercan and Szymon Szantula, Husarion

Do you need any support with completing this tutorial or have any difficulties with software or hardware? Feel free to describe your thoughts on our community forum: https://community.husarion.com/ or to contact with our support: support@husarion.com

← About tutorials2. ROSbot - quick start →
  • Preparing hardware
  • First Steps
  • First flashing
  • Summary
Company
About UsContactBlogTerms of service
Developers
DocumentationCommunity forumDownloadsHome Page
Social
FacebookTwitterGitHub
Copyright © 2021 Husarion sp. z o.o.