owned this note
owned this note
Published
Linked with GitHub
###### tags: `ROS1` `Jetson nano`
# Jetfalcon and setup environment
Before controlling Jetfalcon, you need to setup the operating environment.
If you had done this step, please go to the next unit: [1. Jetfalcon and teleoperation](https://hackmd.io/YRJTVH6NT1GJ4bZbisc_jQ).
## Hardware you need to prepare before writing image
To prepare your microSD card, you’ll need a computer with Internet connection and the ability to read and write SD cards, either via a built-in SD card slot or adapter. Notice space of the MicroSD card need **bigger than 32 GB**.
## 1. Write Image to the microSD Card
### 1-1. Install balenaEtcher
I suggest using balenaEtcher to write the image with Microsoft windows system. Please visit the official website to download the software: [balenaEtcher official website](https://www.balena.io/etcher/)

Please click the "Download for Windows(x86|x64)" button to download and then run the file to install. If you can install smoothly then you can see the icon "balenaEtcher" in the desktop.
### 1-2. Download the image
Nvidia offer ubuntu 18.04 image for the Jetson nano now(2021/10/18). We can use the third-party image to write to the microSD Card. Please visit this webiste to download and unzip file:
[]([sdf](https://developer.nvidia.cn/zh-cn/embedded/downloads))
### 1-3. Start writing image!
Ok! Now we have already prepared to write image to the microSD Card! Please double click icon "balenaEtcher" on your desktop to run the software.

If you can see the image above on your desktop, then you can follow the steps below to write image:
> 1. click "Flash" from file and select your image. If you don't rename the image file, you should select "sd-blob-b01.img"
> 2. If you use adapter, please insert it into your computer and then click "Select target" to select your microSD card.
Great! Now everything is done, you can see the similar image below:

Please click the blue button "Flash!", and then you will need some time to flash the image. If the balenaEtcher finish flashing normally, you can see the similar image below:

Now you can take out the microSD card from your computer.
## 2. Install Ubuntu 18.04 on Jetfalcon
In this step, we have to install Ubuntu 18.04 through the microSD card. Please insert the microSD card into the Jetson nano. After that, you can power on Jetson nano and follow install steps to install Ubuntu 18.04.
## 3. Install ROS-Melodic
we can use the [ROS_melodic_install.sh](https://github.com/kjoelovelife/jetfalcon/tree/master/install) to install ROS1, Please followe these steps below to install.
### 3-1. Open the terminator and download the project
Please press **[ctrl] + [alt] + [t]** on desktop to open the terminal

Next, type the command to install git
```bash=
sudo apt update && sudo apt install git
```

Now you can use git to download the project jetfalcon. Please type the command below to download the project jetfalcon
```bash=
git clone https://github.com/kjoelovelife/jetfalcon
```

### 3-2. Use script to install ROS-Melodic
Please type the command below in the terminal to install ROS-melodic:
```bash=
source ~/jetfalcon/install/ROS_melodic_install.sh
```

I assume you use microUSB to power the jetson nano, this script will setup your power mode with 5W automatically. If not, you can change the power mode by yourself in the script before you install ROS-Melodic.
### 3-3. Test ROS-Melodic
Great! Now you have installed ROS-Melodic on your jetson nano. You can type the code bellow to test:
```bash=
roscore
```

After test done, remember press **[ctrl]+[c]** in terminal for shutdowning the master node.
## 4. Build project jetfalcon workspace
This step is the last step and make sure you have done:
1. [Write Image to the microSD Card](https://hackmd.io/O9XFkTjYT9moNu9A2E5cTA#1-Write-Image-to-the-microSD-Card)
2. [Install Ubuntu 18.01 on Jetfalcon](https://hackmd.io/O9XFkTjYT9moNu9A2E5cTA#2-Install-Ubuntu-1804-on-Jetfalcon)
3. [Install ROS-Melodic](https://hackmd.io/O9XFkTjYT9moNu9A2E5cTA#3-Install-ROS-Melodic)
OK! Before building the workspace, there are some dependencies for the project jetfalcon. Please type the command below to install these dependencies:
```bash=
source ~/jetfalcon/install/dependencies.sh
```

Next, please type the command below to build the workspace for project jetfalcon.
```bash=
cd ~/jetfalcon/catkin_ws && catkin_make
```

Building workspace will take some times. You can buy a coffee or relax yourself in building time :).
After building done, please type the command below for setting up the operating environment in the terminal:
```bash=
echo "source ~/jetfalcon/setup/environment.sh" >> ~/.bashrc
```
And then update the operating environment in the terminal, you can find some information shown on the terminal.

### 5. Copy the parameters
There are many paramters to define the Jetfalcon's motion, but every Jetfalcon must need different values of the parametes to move. Therefore, There are many "default" parameters in the project jetfalcon and we need to copy these to the different Jetfalcon. We use hostname to distinguish different Jetfalcon, so copy these parameter from "default" to "hostanme" is the needed step. Please type the command below to copy the default parameters:
```bash=
source ~/jetfalcon/setup/set_parameter.sh
```

There are three different informations can be shown on the terminal
> Copy file.. : copy the default parameter to hostname parameter
> File ... exsted.. : the hostname parameter had existed and pass it.
> There are special..: must adjust manually
Now we have set up the operating environment! Please visit it to go next unit: [1. Jetfalcon and teleoperation](https://hackmd.io/YRJTVH6NT1GJ4bZbisc_jQ).