-
Notifications
You must be signed in to change notification settings - Fork 229
Platform Agnostic Launch System
autorally/autorally_util/99-autoRally.rules
is a template for the udev rules used by the AutoRally project. You will need to follow the instructions in this file to fill in the necessary values for each device. If you are maintaining multiple platforms or spare components, you will need to duplicate some of the entries so that each device has its own entry.
Udev rules key off of properties associated with USB devices. To lookup the values of these properties for your devices, use the udevadm
command.
For example, if I plug an Arduino Due into my computer, the computer might automatically assign that device to the path /dev/ttyACM0
. If I then run this command:
udevadm info --query=property /dev/ttyACM0
I see the following output:
DEVLINKS=/dev/serial/by-id/usb-Arduino__www.arduino.org__Arduino_Due_Prog._Port_75439313737351F052A0-if00 /dev/serial/by-path/pci-0000:00:14.0-usb-0:4:1.0
DEVNAME=/dev/ttyACM0
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb3/3-4/3-4:1.0/tty/ttyACM0
ID_BUS=usb
ID_MM_CANDIDATE=1
ID_MODEL=Arduino_Due_Prog._Port
ID_MODEL_ENC=Arduino\x20Due\x20Prog.\x20Port
ID_MODEL_ID=003d
ID_PATH=pci-0000:00:14.0-usb-0:4:1.0
ID_PATH_TAG=pci-0000_00_14_0-usb-0_4_1_0
ID_REVISION=0001
ID_SERIAL=Arduino__www.arduino.org__Arduino_Due_Prog._Port_75439313737351F052A0
ID_SERIAL_SHORT=75439313737351F052A0
ID_TYPE=generic
ID_USB_CLASS_FROM_DATABASE=Communications
ID_USB_DRIVER=cdc_acm
ID_USB_INTERFACES=:020201:0a0000:
ID_USB_INTERFACE_NUM=00
ID_VENDOR=Arduino__www.arduino.org_
ID_VENDOR_ENC=Arduino\x20\x28www.arduino.org\x29
ID_VENDOR_ID=2a03
MAJOR=166
MINOR=0
SUBSYSTEM=tty
USEC_INITIALIZED=4904433
Here I can see device information such as vendor, product, and serial number. Most devices in the udev rules template only need you to fill in the serial number, listed in these results as ID_SERIAL_SHORT
.
Cameras
The PointGrey Flea3 USB3 Cameras have an additional identifier called the GUID. The camera's serial number is actually a combination of this GUID and other information. While udev will only key off of the camera's serial number, most of ROS and the AutoRally system use the GUID to uniquely identify cameras. For this reason, you will need to enter the GUIDs of your cameras in a few places during this configuration process, including this udev rules template.
The easiest way to find the GUID of your camera is to use coriander
. Running sudo coriander
while a camera is connected to your computer should launch a GUI application for controlling the cameras. In this window, you will see information about the camera, including its GUID. For this project, you will only need the 14 characters starting with a lower-case 'b', without any non-alphanumeric characters. For example, in the highlighted screenshot below, the shown GUID is 0x00b09d-0100d70a0a
, which for this project should be recorded as b09d0100d70a0a
.
When launching the platform, you will source a setup script which will setup the necessary environment variables used by AutoRally. These setup scripts all rely on the setupEnvVariables.sh
script found in autorally/autorally_util
.
The primary purpose of this script is to identify which chassis the compute box is mounted to (if you have built more than one), and which cameras are connected (if you keep more than one left/right pair). There are a few things you will need to edit in this file.
-
Chassis Identifiers Each chassis has an Arduino Due mounted inside of the electronics box. Each Arduino Due has a unique serial number, so we can use this number to identify which chassis the compute box is mounted to.
In line 29, replace
ARDUINO_DUE_SERIAL_NUMBER
with the serial number of your Arduino Due. (Refer to 1. Udev Rules for instructions on how to find this serial number.)In line 31, replace
CHASSIS_NAME
with a unique string identifier. (For example, we use "alpha" and "beta" to distinguish our two chassis.)If you have a second chassis, uncomment lines 32 through 34 and insert the serial number and identifier for the second chassis.
If you have more than two chassis, simply duplicate lines 32 through 34 for each additional chassis.
-
Camera Identifiers In 1. Udev Rules, you used udev rules to match a camera serial number to its GUID. In this step, we need to tell the system which cameras are mounted on the left side of the platform, and which cameras are on the right side.
In line 44, replace
GUID
inarCamera_GUID
with the GUID of the right camera.In line 46, replace
GUID
with the GUID of the right camera.If you have multiple compute boxes, or spare right cameras, uncomment lines 47 through 49 and fill in the GUID for the other camera. Similar to the chassis identifiers, duplicate and complete lines 47 through 49 for each additional camera.
In line 56, replace
GUID
inarCamera_GUID
with the GUID of the left camera.In line 58, replace
GUID
with the GUID of the left camera.Again, if you have multiple compute boxes or spare left cameras, uncomment and duplicate lines 59 through 61 for each additional camera.
ROS distributed launches establish one machine as the "master" machine, where rosmaster will run and coordinate ROS communication. Environment variables are used to tell ROS which host on the network should be used as master. We have condensed the necessary environment variable settings into a single setup script for each compute box, as well as one for running all nodes on your local host.
The template for these setup scripts is autorally/autorally_util/setupEnvRemote.sh
. You should duplicate this file and replace "Remote" with the a unique string identifier for each compute box.
In each of these files, replace COMPUTE_BOX_HOSTNAME
with the hostname (or static IP address) of the compute box. This value will need to be replaced on lines 4 and 5.