The car will try to connect to rtis-f1tenth-network. The router has an IP reservation for 192.168.1.2
Current network configuration:
rtis-f1tenth-network: autoconnect priority 4Aardvark: autoconnect priority 1
you may add your own network and password
precious and wall-e, and the password for both is 2244Connect over ssh: ssh precious@192.168.73.242 (Substitute the correct address from your router/hotspot)
Turn on your controller. You should see connected appear somewhere in the logs. Make sure ROS has permissions for the controller: sudo chown wall-e /dev/input/event*. Make sure the controller appears in /dev/input using ls /dev/input/ - there should be a js0 in the list.
sudo bluetoothctl
sudo systemctl restart bluetooth.servicescan onController line should appear in the scan results. Note the address (in the form of 00:00:00:00 etc) in that linepair 00:00:00..., using the address found in the previous step. Tab completion works here - type the first few digits and press tabtrust 00:00:00... and connect 00:00:00...bluetoothctl console with exit/dev/input using ls /dev/input/ - there should be a js0 in the list.Explore the ros2_ws workspace. There is an f1tenth_stack folder with some launch scripts that handles sensor+motor nodes.
Connect a controller, and make sure permissions are set properly. cd into your workspace. Each terminal needs to have it’s ROS configuration variables set - do source /opt/ros/foxy/setup.bash (sets up the system’s ROS commands) and source install/setup.bash (sets up the workspace ROS commands). If you get many ‘no such package/node’ results when running ros2 commands, make sure you ran the source commands in the terminal.
Run ros2 launch f1tenth_stack bringup_launch.py
This is if the car is using the standard
f1tenth_stacksetup. Some cars have car-specific changes inf1tenth_stack, but the command should be the same. We substitute the teleop node inf1tenth_stackwith our own inkw_f110_drive, which adds extra features like virtual gear shifting and autonomous safety buttons.
Keep this terminal running!
you can use tmux sessions to keep a command running ‘in the background’
Our modified teleop script publishes a bool over /run_auto. Your own autonomous code should listen to this, and only publish to /drive when /run_auto is true.
Important: when
/run_autochanges from true to false, send one/drivemessage with speed set to 0 to ensure that the car comes to a stop!
The rl_driver node has some parameters that can be passed over the command line, through a config file, or left as default. The rl_driver node is best run using a launch file: ros2 launch rtis_f110_rl rl_driver.launch.xml. The config parameters are loaded from config/rl_driver.yaml.
Place models in the models folder, and set the model appropriately in the config file.
Make sure
bringup_launch.pyis running in a different terminal, otherwise, therl_driverwill do nothing
If you get weird torch or library errors when running the rl_driver, try
source setup_torch.bash
/drive: an AckermannDriveStamped message, that contains a target speed value and steering angle. Publish to this to control the vehicle.
/scan: a LaserScan message, that contains the lidar scan data. Subscribe to this to get the lidar data. This publishes 1080 points, with a 270 degree field of view at 40Hz.
/odom: a Odometry message, that contains the vehicle’s position and velocity. Subscribe to this to get the vehicle’s position.
/run_auto: A Bool message, that contains a boolean value. Publish a true value to this topic to start the vehicle’s automatic control package. Your driving code should listen to this topic, and only publish to /drive when /run_auto is true. This topic is published by the teleop node whenever the correct button is pressed on a gamepad.
For all terminals, cd into ros2_ws (or your own workspace) and soucre the workspace with source install/setup.zsh
Then, in one terminal, start the driving stack: ros2 launch f1tenth_stack bringup_launch.py
in another terminal, start Cartographer (the mapping tool): ros2 run cartographer_ros cartographer_node -configuration_directory src/kw_f110_drive/config -configuration_basename cartographer.lua
this uses the cartographer.lua config in the
kw_f110_drivepackage
In a third terminal, start the occupancy grid publisher: ros2 run cartographer_ros occupancy_grid_node -resolution 0.05 -publish_period_sec 1.0
This is necessary to visualize the generated map before saving it. The map will appear on the
/maptopic
Drive around for a while, and watch the map build up
To save it, run ros2 run nav2_map_server map_saver_cli -f lab_space
replace
lab_spacewith the name of the map to save to.
you can stop theoccupancy_grid_nodeand re-use that terminal, or create a new terminal tab
Copy the generated lab_space.pgm and lab_space.yaml to src/particle_filter/maps and rebuild. Edit src/particle_filter/config/localize.yaml and fill in the map name.
Run OMP_NUM_THREADS=1 ros2 launch particle_filter localize_launch.py
OMP_NUM_THREADS=1is necessary to fix a numpy bug - otherwise the localization will take up 100% of all CPU cores!
wall-e uses ROS_DOMAIN_ID=2
The following link contains a Dockerfile and assets that starts a virtual desktop with Ros 2 Foxy installed. Built it with docker build -t kw/ros2-desktop-vnc:foxy . and run it with sudo docker run --group-add video --group-add render --network host --security-opt seccomp=unconfined --shm-size=512m kw/ros2-desktop-vnc:foxy
Connect to the VNC session at localhost:5902. When you create a terminal in the session, ROS2 will already be sourced and ready, just make sure to run export ROS_DOMAIN_ID=2 (depending on the system or car you’re monitoring). Then, run rviz2
Adapted from https://github.com/husarion/ros2-desktop-vnc
Connect the car to a display, keyboard, and mouse to change WiFi settings, OR use the micro-usb port and minicom.
To build only one package (which speeds up compile times if you only changed a subset of packages), we have a macro called rosbuild_only. Just list any packages that need rebuilding rosbuild_only simple_driver.
also see faster builds