-
Notifications
You must be signed in to change notification settings - Fork 11
Planning Group Workshop notes (4 8 21)
Let's start by setting up the tools we'll use for development. These are:
- Git (here)
- Docker and Docker Compose
- Windows users: Docker for Windows includes Compose already, but be sure to install WSL components during the Docker installation (here)
- Voltron Development Environment (VDE) files
For our demonstration today, you'll also want to download this ROS bag, which includes simulated Lidar data. Download the whole folder and unzip it.
- Create a folder in a convenient place on your system. This is where we'll store our VDE container files.
- Open your system's command line. On Windows, you can navigate to your new folder in the File Explorer, then click
File -> Open Windows PowerShell -> Open Windows PowerShell
. This will open your command line within the folder. - Once your command line is in the new folder, type
git clone https://github.com/Voltron-UTD/vde.git
. This will (basically) download VDE. - Move into the new VDE folder using
cd vde
. - Finally, run the startup script.
- On Windows, type
.\start.bat
(while in the VDE folder). You can also double-click "start.bat" in your File Explorer instead. - On Linux, run
./start.sh
. You may need to first give the script execution permissions by runningsudo chmod +x start.sh
.
- On Windows, type
On first run of the startup script, Docker will download some more files for you. It will take some time. Afterwards startup is very quick.
In ROS lingo, a "workspace" is simply a folder on your system where your code is built and stored. Workspaces follow a specific structure. All ROS packages, including Autoware.Auto, are stored in workspaces. A workspace can store multiple packages, and a package can store multiple executables ("nodes").
Let's set up our own workspace for Voltron. Luckily, we have scripts to do this for us.
-
Within VDE (Did you run the startup script? Your terminal will say
docker@vde:~$
), rungit clone https://github.com/Voltron-UTD/luna_ws.git
. - Run
cd luna_ws
to enter the new folder, then runpython3 init.py
to start the convenience script. - A warning will explain that any existing files in the folder will be cleared. We just created this folder, so there's nothing to clear. Type
y
then press enter.
Our ROS workspace, "Luna WS," is set up!
Let's create a simple package that reads incoming Lidar data and calculates the "center" of the observed point cloud. These steps are mostly taken from the ROS2 docs.
- Once again, make sure you're within VDE. If you aren't, run the start script.
- "Source" your ROS installation by running
source /opt/ros/foxy/setup.bash
.- Sourcing makes all of the ROS code visible to the operating system. Without sourcing, your computer would not know where to find the programs that you ask it to run. Many ROS-related issues can be fixed just by sourcing things.
- Move to the source code folder of the workspace by running
cd ~/dev_ws/src
. "src" is where we'll keep all the code we write. - Run
ros2 pkg create --build-type ament_cmake --dependencies rclcpp sensor_msgs --node-name lidar_printer voltron_tutorial
.-
--build-type ament_cmake
indicates that we're using C++, so that we'll build using CMake. Not important to understand that now. -
--dependencies rclcpp sensor_msgs
says that our package will depend on rclcpp (ROS Common Library for C++, basically the ROS API) and sensor_msgs (a C++ library that can interpret incoming sensor data, like Lidar point clouds). -
--node-name lidar_printer
generates a node named lidar_printer within our package. -
voltron_tutorial
is the name of our new package
-
- Keep your command line with VDE open. You'll be using it in a bit.
The "pkg create" script is just for convenience. You can write all the necessary files that it generates yourself, but who has time for that?
Now's a good time to mention that VDE (Docker) creates a link between the home folder within the container (everything under cd ~
) and the user folder of the host PC (on Windows, C:\Users\[Your Username]\vdehome
. As VDE is currently configured, only files stored in this linked folder persist across VDE sessions. All other files are reset once VDE is restarted.
The folder link is useful for, say, working on code in an IDE on your host PC. Let's do that.
- Open the workspace folder in your favorite IDE/text editor. On Windows, this folder is
C:\Users\[Your Username]\vdehome\luna_ws
. - Open
./src/lidar_printer.cpp
in the editor. - We can go over this code together, but at the end of the day, lidar_printer.cpp needs to look like this. Be sure to save it.
- In your VDE terminal, navigate to your workspace folder (
cd ~/luna_ws
). - Build the code we just wrote by running
colcon build
. - Source
luna_ws
by runningsource install/setup.bash
in your workspace's root. - Finally, run our new node using
ros2 run voltron_tutorial lidar_printer
- Remember that
voltron_tutorial
is our package name andlidar_printer
is our node name.
- Remember that
The node should throw an exception: Field x does not exist
. The node is complaining that it can't find an Lidar data. Let's give it some.
"ROS bags," or simply rosbags, are files that allow us to record and reply sensor data, among other info. We'll use it here to play back some Lidar data.
- Did you download the rosbag from the beginning? If not, do so here and unzip it.
- You'll want to now move that rosbag (the whole folder) into our linked folder. It doesn't matter where, but VDE will need access to it.
- Within VDE, navigate to the directory where you kept your rosbag (the parent of the rosbag folder) and run
ros2 bag play -l lidar_rosbag
-
-l
means "run on a loop"
-
- In your text editor, create a new folder within
luna_ws/src/voltron_tutorial
calledlaunch
, create a new file calledlidar_printer.launch.py
and paste this into it. - Add
install(DIRECTORY
launch
DESTINATION share/${PROJECT_NAME}/)
to CMakeLists.txt line 36, above if(BUILD_TESTING)
.
3. Finally, rebuild your workspace by doing, in VDE, cd ~/luna_ws
and colcon build
.
- Source your workspace (since you've rebuilt and added a new file) by running
source install/setup.bash
withinluna_ws
. - We'll also now need to source Autoware since we'll be using some of their code. Run
source /opt/AutowareAuto/install/setup.bash
. - At last! Run
ros2 launch voltron_tutorial lidar_printer.launch.py
. It should start printing average points from the rosbag data.
General
- Papers for literature review
- Demo 2: Grand Tour (Overview)
- Our Team
- Learning resources
- Meeting notes
- Archived Pages
Development & Simulation
- Code Standards and Guidelines
- Writing and Running Tests
- Installation and usage
- Logging into the Quad Remote Simulator
- Running the Simulator
Software Design
Outdated or Uncategorized