Udev rules
Waternet edited this page Apr 25, 2017
·
6 revisions
To use the sensors like GPS, IMU and the actuation platform, the software has to open the port each device is connected to. These ports can change every time they are plugged in, so a solution had to be found to find the right port for each device automatically. This is done by adding udev rules to create a symlink which can be used in the software, and will always point to the right port. This solution is only for Linux.
New symlinks should have a format like: /dev/nautonomous/<sensor-name>
.
- Navigate to
/etc/udev/rules.d
- Create/edit the file
99-nautonomous.rules
with your preferred editor (gedit/nano/vim etc) - For the currently used sensors, make sure the following rules are present:
SUBSYSTEM=="tty", ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a8", SYMLINK+="nautonomous/gps"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="bef3", ENV{ID_USB_INTERFACE_NUM}=="00", SYMLINK+="nautonomous/actuation"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="nautonomous/imu"
- Each of these rules should be on a single line.
- Add any new rules for new sensors in this same way, finding the unique idVendor and idProduct.
- Add permissions to new symlinks:
sudo chmod 777 /dev/nautonomous/gps /dev/nautonomous/actuation /dev/nautonomous/imu
- Now reload the udeve rules in order for them to apply using this command:
sudo udevadm control --reload-rules
. You might have to reconnect the sensors afterwards.