Skip to content

Getting Started

Ossian Eriksson edited this page May 27, 2021 · 16 revisions

Elaborated quick start guide.

Installation

Overview of Software and Frameworks

  • git is used for version control and Github as a git remote as well as hosting Github pages, running Actions, managing pull requiests etc.
  • This project uses ROS noetic (ROS 1).
  • ROS noetic was built to run on Ubuntu 20.04 (Focal Fossa), which is also the OS this project has been developed and tested on.
  • ROS packages such as rviz (data visualization) and rqt_reconfigure (GUI for dynamic reconfiguring of ROS parameters) are installed by rosdep, the "package manager" of ROS.
  • Kvasers canlib drivers are used for communication on the Twizy's CAN bus.
  • libsbp, or rather the python package sbp is used for communication with GNSS sensors.
  • webots is used to simulate a virtual car for testing.

Operating System

This project was developed and tested on Ubuntu 20.04 (Focal Fossa), which can be dual booted alongside other operating systems (see online tutorials). Further instructions assume you are running on Ubuntu 20.04:

After you install the OS and before going further you should upgrade firmware:

sudo apt update
sudo apt upgrade

then reboot. Skipping this step might prevent self-built drivers from loading.

Set Up Git and Github

  1. Install git

    sudo apt install git
  2. Create a Github account

  3. Add a new SSH key to your GitHub account

  4. Clone the repo

    git clone [email protected]:OssianEriksson/autonomous-twizy.git ~/autonomous-twizy/src

Run the Installation Script

Running the following script will install all the software mentioned under Overview of Software and Frameworks for you:

~/autonomous-twizy/src/install.sh

If you experience trouble with the installation, make sure you have completed all the above mentioned steps correctly. Otherwise the installation log and the source code of the script that generated it is your friend.

Finish the installation by running

source ~/.bashrc

Buildning

First make sure to change into the catkin workspace:

cd ~/autonomous-twizy

The build all packages in the workspace using the command

catkin_make

Since no build existed prior to running the above commands, you also need to run

source devel/setup.bash

once. In the future the .bashrc script which runs in every new terminal will take care of sourcing devel/setup.bash for you.

Running Tests

Make sure to first build all packages.

Run All Tests

catkin_make run_tests

Run Specific Test

To run a specific python unittest, use

nosetests3 <path/to/file.py> [--nocapture]

where --nocapture allows the tests to print directly to the console.

To instead run a specific rostest launch (test) file, use

rostest <package_name> <test_file.test> [--text]

where --text prints the test log (including stdout) directly to the console instead of saving the result to a file for later viewing.

Run Example Simulation

Make sure to first build all packages.

Keyboard Controllable Webots Simulation

The following command will start an example simulation where you can drive the car with your keyboard:

roslaunch twizy_bringup webots_keyop.launch

API Documentation

Python/C++

You can view pre-built code API on Github pages. The pre-built documentation gets automatically regenerated every time a commit is pushed to the master branch. Alternatively you can build the documentation locally with

~/autonomous-twizy/src/build_docs.sh

This script installs some dependencies and then builds API documentation for all packages in the workspace with a rosdoc.yaml file in its root directory using rosdoc_lite. The API docs will get built to ~/autonomous-twizy/docs, and you can view the finished build in a web browser, for example firefox:

firefox ~/autonomous-twizy/docs/index.html

ROS

See READMEs in root directory of the corresponding ROS package, e.g. for piksi_multi_rtk see piksi_multi_rtk/README.md.