16
A (very) Fast Intro to BBBlue, UNIX, LINUX, and RoboticsControlLib (good luck) Jeff Friesen

A (very) Fast Intro to BBBlue, UNIX, LINUX, and ...renaissance.ucsd.edu/courses/mae144/BBBlue_intro_10_3_2018.pdf · •In Unix you navigate through the filesystem by changing your

  • Upload
    others

  • View
    9

  • Download
    0

Embed Size (px)

Citation preview

Page 1: A (very) Fast Intro to BBBlue, UNIX, LINUX, and ...renaissance.ucsd.edu/courses/mae144/BBBlue_intro_10_3_2018.pdf · •In Unix you navigate through the filesystem by changing your

A (very) Fast Intro to BBBlue, UNIX, LINUX, and

RoboticsControlLib (good luck)

Jeff Friesen

Page 2: A (very) Fast Intro to BBBlue, UNIX, LINUX, and ...renaissance.ucsd.edu/courses/mae144/BBBlue_intro_10_3_2018.pdf · •In Unix you navigate through the filesystem by changing your

Setting up the BBBlue

Page 3: A (very) Fast Intro to BBBlue, UNIX, LINUX, and ...renaissance.ucsd.edu/courses/mae144/BBBlue_intro_10_3_2018.pdf · •In Unix you navigate through the filesystem by changing your

Your BBBlue (so many ports)Tips:

• Work on clean non-conductive surface

• Use an external power supply instead of just USB

• Come to office hours if you have problems

Page 4: A (very) Fast Intro to BBBlue, UNIX, LINUX, and ...renaissance.ucsd.edu/courses/mae144/BBBlue_intro_10_3_2018.pdf · •In Unix you navigate through the filesystem by changing your

Flashing the BBBlue EEPROM

Steps:• Download the latest image• Download Etcher• Plug in SD card and Image it with

etcher• Once completed plug into BBBlue

and cycle power• Wait for all LEDs to go solid for an

extended time before shutting downand removing SD card

• Turn back on and boot into updated image

Things You will Need:

• Micro SD card with 4 Gb or more storage

• Micro USB Cable

• SD Card Reader

Recommended Bits:

• 12V supply

Page 5: A (very) Fast Intro to BBBlue, UNIX, LINUX, and ...renaissance.ucsd.edu/courses/mae144/BBBlue_intro_10_3_2018.pdf · •In Unix you navigate through the filesystem by changing your

Setting Up SSH

• Download a client for your OS that supports SSH (on windows I prefer KiTTY)

• Plug in your BBBlue through USB to the host computer

• Test if your BBBlue is connecting by going to: http://beagleboard.org/getting-started

• SSH Into the local IP address: 192.168.7.2

• Login: debian Password: temppwd

• You are now logged in to a remote terminal!

Page 6: A (very) Fast Intro to BBBlue, UNIX, LINUX, and ...renaissance.ucsd.edu/courses/mae144/BBBlue_intro_10_3_2018.pdf · •In Unix you navigate through the filesystem by changing your

Unix Environment

Page 7: A (very) Fast Intro to BBBlue, UNIX, LINUX, and ...renaissance.ucsd.edu/courses/mae144/BBBlue_intro_10_3_2018.pdf · •In Unix you navigate through the filesystem by changing your

Adding your own User name/password

• Add a new user account/home folder: sudo useradd –m yourLogin

• Add a user password: sudo passwd yourLogin

• You will be prompted to enter your new password

• Add user to the sudo group: sudo usermod -aG sudo yourLogin

• Edit the /etc/passwd to set terminal to bash instead of dash:

sudo nano /etc/passwd

and add /bin/bash at the very end of the file after the last :of your added username

Page 8: A (very) Fast Intro to BBBlue, UNIX, LINUX, and ...renaissance.ucsd.edu/courses/mae144/BBBlue_intro_10_3_2018.pdf · •In Unix you navigate through the filesystem by changing your

Navigation• In Unix you navigate through the filesystem by changing

your active directory

• File locations can either be defined globally or locally:• Lets Say our current active directory is /usr/bin and we want

to run which is located one directory down in myDirectoryand is named myFile.run

• From our current active directory we could reference it as: myDirectory/myFile.run

• From any arbitrary directory we could reference it with the global path /usr/bin/myDirectory/myFile.run

• To list the contents of your current active directory use: ls

• To change to a directory use: cd

• To make a directory use: mkdir

• Tab complete is your best friend here, let me demo!

Page 9: A (very) Fast Intro to BBBlue, UNIX, LINUX, and ...renaissance.ucsd.edu/courses/mae144/BBBlue_intro_10_3_2018.pdf · •In Unix you navigate through the filesystem by changing your

Nano demo with Obligatory “Hello World”

• Nano is a command line text editor

• Use: nano <txtFileToEdit>

• If the file doesn’t exist it will create it

• Now lets go play around in the console!

Page 10: A (very) Fast Intro to BBBlue, UNIX, LINUX, and ...renaissance.ucsd.edu/courses/mae144/BBBlue_intro_10_3_2018.pdf · •In Unix you navigate through the filesystem by changing your

File Ownership/Permissions

• Every file in Linux has an associated set ofprivileges/ownership

• Use command: ls –l to list files with these details

• The root (or super) user is the highest privilege tier and files owned by root can only be modified by root

• Prefacing any command with sudo <your cmd here>

will cause that command to be executed as the root user

• This system is in place to prevent you from accidentlydestroying critical system files, don’t use the sudocommand unless it is needed and you understand what you are doing

• You can use sudo chmod 666 <path to file here> to change a root owned file to be read/write for all users

Page 11: A (very) Fast Intro to BBBlue, UNIX, LINUX, and ...renaissance.ucsd.edu/courses/mae144/BBBlue_intro_10_3_2018.pdf · •In Unix you navigate through the filesystem by changing your

Managing Running Programs/Processes

• You can use the top command to open a simple console which shows current memory/cpu/network usages ofrunning programs

• If a process is frozen up or taking too much resources you can kill it by pressing ‘k’ typing its PID (process ID) then pressing enter

• You can use ctrl-c to exit out of top (as well as most other processes)

• shift+M to sort by memory usage• shift+ P to sort by CPU usage• shift+ N to sort by process ID• shift+ T to sort by the running time

Page 12: A (very) Fast Intro to BBBlue, UNIX, LINUX, and ...renaissance.ucsd.edu/courses/mae144/BBBlue_intro_10_3_2018.pdf · •In Unix you navigate through the filesystem by changing your

Package Manager (Apt-Get)

• Download and install package: • apt-get install package

• Update apt's list of available packages: • apt-get update

• Upgrade all installed packages with upgrades available: • apt-get upgrade

• Get information on installed package:• dpkg -s package

Page 14: A (very) Fast Intro to BBBlue, UNIX, LINUX, and ...renaissance.ucsd.edu/courses/mae144/BBBlue_intro_10_3_2018.pdf · •In Unix you navigate through the filesystem by changing your

UNIX Commands Cheat Sheet

Page 15: A (very) Fast Intro to BBBlue, UNIX, LINUX, and ...renaissance.ucsd.edu/courses/mae144/BBBlue_intro_10_3_2018.pdf · •In Unix you navigate through the filesystem by changing your

Setting up RobotControlLib

Page 16: A (very) Fast Intro to BBBlue, UNIX, LINUX, and ...renaissance.ucsd.edu/courses/mae144/BBBlue_intro_10_3_2018.pdf · •In Unix you navigate through the filesystem by changing your

Installing the RobotControlLib

• Update the list of available packages: sudo apt-get update

• Upgrade to the latest version of the RobotControlLib:sudo apt-get upgrade RobotControlLib

• Test if everything is working correctly: rc_test_drivers