Skip to content
Open

Ros2 #42

Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
bdfeb5a
switch to ros2 shared lib
nathantsoi Aug 6, 2025
929f3ea
update build for colcon
nathantsoi Aug 6, 2025
c93cd95
ros2 code updates
nathantsoi Aug 6, 2025
f663cf6
read sim configs
nathantsoi Aug 15, 2025
3451af8
docs for sim, fix teleop
nathantsoi Aug 18, 2025
222c1f2
ros2 hardware
nathantsoi Sep 1, 2025
81d4ad5
remove old launch files, configure the joystick defaults and add a ca…
nathantsoi Sep 1, 2025
d7ba896
hokuyo launch
nathantsoi Sep 21, 2025
8f5ebd1
clean shutdown in ros2
nathantsoi Sep 28, 2025
b95a31b
bind to bluetooth if not already on
nathantsoi Sep 28, 2025
29fb863
static config path
nathantsoi Sep 29, 2025
077663c
more joystick modes
nathantsoi Sep 29, 2025
68df851
display camera, show joystick status
nathantsoi Sep 29, 2025
9a6836f
handle rescaling
nathantsoi Sep 29, 2025
05577a0
remove debugging output
nathantsoi Sep 29, 2025
a0cca93
gui cleanup
nathantsoi Sep 29, 2025
b4562bb
control via tmux
nathantsoi Sep 29, 2025
fbbf7bc
switch ros led to imu and show disk usage
nathantsoi Sep 29, 2025
1a49cc7
fix sizing
nathantsoi Sep 29, 2025
f6fca48
remove shutdown button, since we're in the container
nathantsoi Sep 29, 2025
f40a5f3
bind controller by mac to avoid a multiple-bind situation
Oct 19, 2025
2959ba1
switch to ros2 amrl shared branch
Oct 20, 2025
cfb2c71
default car.lua file
Oct 22, 2025
7f5be01
fixing build action
nathantsoi Oct 25, 2025
33f5556
fixing build actions
nathantsoi Oct 25, 2025
e292ce3
fixing build action
nathantsoi Oct 25, 2025
41e9f9e
fixing build actions
nathantsoi Oct 25, 2025
dd57b15
fixing build tests
nathantsoi Oct 25, 2025
fa785f6
fixing build tests
nathantsoi Oct 25, 2025
c17bbe8
fix build
nathantsoi Oct 25, 2025
cd2fee9
no mounts on github build action docker
nathantsoi Oct 25, 2025
9b3b037
building from 0
nathantsoi Oct 25, 2025
662d2c0
why wont it source
nathantsoi Oct 25, 2025
9bd2fbe
fix odom publishing to tf and turn off hokuyo time calibration
nathantsoi Nov 1, 2025
fcf028f
ekf to fuse imu and wheel odom
nathantsoi Nov 7, 2025
8f5758b
fix status indicators
nathantsoi Nov 10, 2025
34e9f29
calibration script, mode names with same size to avoid moving items i…
nathantsoi Nov 10, 2025
4f3a222
read max_steering_angle from the config file and add it to the calibr…
nathantsoi Nov 12, 2025
f705f9b
wip
nathantsoi Nov 14, 2025
692ff2a
trim
nathantsoi Nov 19, 2025
e348cf4
fix recording icon
nathantsoi Nov 22, 2025
f59a469
implement a bezier steering curve to flatten the curve torwards the m…
nathantsoi Nov 24, 2025
36b1925
gui upgrades for recording
nathantsoi Nov 24, 2025
cb34e10
sim
nathantsoi Dec 3, 2025
daa3d55
normalize the vesc node restarting text
Dec 13, 2025
43de722
fix some unnecessary warnings and errors
Dec 13, 2025
f08d4f7
add an instant_override mode that allows the user to override the aut…
Jan 3, 2026
d0ba363
airfield packaging: airfield.yaml, AIRFIELD.md, .dockerignore
JacobTaira Jul 1, 2026
5cddc94
ros2/jazzy build + config adjustments (gui, CMakeLists, vesc.lua)
JacobTaira Jul 1, 2026
7604866
airfield.yaml: declare colcon_args so auto-builds use Hardware mode
JacobTaira Jul 2, 2026
5d1be92
vesc_driver: fix startup segfault + load-sensitive init timeout; joys…
JacobTaira Jul 3, 2026
34eb82b
track .air (airfield container mounts): X11 socket dir + gdm Xauthority
JacobTaira Jul 3, 2026
0268bca
vesc_driver: remove fuse_imu_ member that shadowed the lua config bin…
JacobTaira Jul 3, 2026
e2db6f3
airfield: depend on camera_calibration
JacobTaira Jul 8, 2026
f354da0
lidar: auto-select RPLIDAR C1 (USB) or Hokuyo at launch
JacobTaira Jul 23, 2026
6dc1402
gitignore: ignore /core dumps
JacobTaira Jul 23, 2026
4e34b01
airfield: stop tracking .air (per-machine local config)
JacobTaira Jul 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 15 additions & 50 deletions .github/workflows/buildTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,64 +6,29 @@ jobs:
# Set the job key. The key is displayed as the job name
# when a job name is not provided
build-test:
# Name the Job
runs-on: ubuntu-latest
name: Build test
# Set the type of machine to run on
runs-on: ubuntu-20.04

container:
image: natester/roboracer_sim:latest
options: --user root
steps:
# Run package update
- name: Run package update
run: |
sudo apt-get update
sudo apt-get dist-upgrade -y

# Install ROS Melodic
- name: Install ROS Noetic
run: |
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt install curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install ros-noetic-desktop python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
sudo rosdep init
rosdep update

# Install dependencies
- name: Install dependencies
run: |
sudo apt-get install git libgflags-dev libpopt-dev libgoogle-glog-dev liblua5.1-0-dev libboost-all-dev libqt5websockets5-dev


# Checks out a copy of your repository
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v5
with:
submodules: 'recursive'

# Checkout and build amrl_msgs
- name: Get amrl_msgs
run: |
source /opt/ros/melodic/setup.bash
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$GITHUB_WORKSPACE:$GITHUB_WORKSPACE/../amrl_msgs
cd $GITHUB_WORKSPACE/..
git clone https://github.com/ut-amrl/amrl_msgs.git
cd amrl_msgs
make


# Checkout and build amrl_maps
mkdir -p $HOME/roboracer_sim_ws/src
cd $HOME/roboracer_sim_ws/src
git clone -b master https://github.com/ut-amrl/amrl_msgs.git
- name: Get amrl_maps
run: |
source /opt/ros/melodic/setup.bash
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$GITHUB_WORKSPACE:$GITHUB_WORKSPACE/../amrl_maps
cd $GITHUB_WORKSPACE/..
git clone https://github.com/ut-amrl/amrl_maps.git

# Compiles the code
mkdir -p $HOME/roboracer_sim_ws/src
cd $HOME/roboracer_sim_ws/src
git clone -b ros2 https://github.com/ut-amrl/amrl_maps.git
- name: Run build
run: |
source /opt/ros/melodic/setup.bash
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$GITHUB_WORKSPACE:$GITHUB_WORKSPACE/../amrl_msgs:$GITHUB_WORKSPACE/../amrl_maps
cd $GITHUB_WORKSPACE
make
cd $HOME/roboracer_sim_ws
source /opt/ros/humble/setup.bash
colcon build --cmake-args -DCMAKE_BUILD_MODE="Software"
shell: bash
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
build/
bin/
install/
lib/
log/
msg_gen/
src/f1tenth_course/
src/ut_automata/
Expand Down
178 changes: 150 additions & 28 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.14.4)
PROJECT(ut_automata)
CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

MESSAGE(STATUS "Compilers found: ${CMAKE_CXX_COMPILER_LIST}")
MESSAGE(STATUS "Using compiler: ${CMAKE_CXX_COMPILER}")
MESSAGE(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
MESSAGE(STATUS "Build Mode: ${CMAKE_BUILD_MODE}")
MESSAGE(STATUS "Arch: ${CMAKE_SYSTEM_PROCESSOR}")

# Set CMake policies
cmake_policy(SET CMP0071 NEW)

# Configure RPATH for proper library linking
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

SET(CMAKE_AUTOMOC ON)
SET(CMAKE_AUTORCC ON)
SET(CMAKE_AUTOUIC ON)
Expand All @@ -26,10 +37,26 @@ ELSEIF(${CMAKE_BUILD_TYPE} MATCHES "Debug")
SET(BUILD_SPECIFIC_LIBRARIES "")
ENDIF()

INCLUDE($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
ROSBUILD_INIT()
SET(ROS_BUILD_STATIC_LIBS true)
SET(ROS_BUILD_SHARED_LIBS false)
message(STATUS "Building with ROS 2")
add_compile_definitions(ROS2)
find_package(rclcpp REQUIRED)
find_package(ament_index_cpp REQUIRED)
find_package(ament_cmake REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(visualization_msgs REQUIRED)
find_package(builtin_interfaces REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(std_msgs REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_geometry_msgs REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(amrl_msgs REQUIRED)
find_package(amrl_maps REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(OpenCV REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(rosidl_default_runtime REQUIRED)

FIND_PACKAGE(Qt5 COMPONENTS Core Widgets Gui WebSockets OpenGL REQUIRED)
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
Expand All @@ -48,64 +75,159 @@ INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/submodules/config_reader/include)

ROSBUILD_GENMSG()
# Generate ROS 2 messages
rosidl_generate_interfaces(${PROJECT_NAME}
"msg/VescState.msg"
"msg/VescStateStamped.msg"
"msg/CarStatusMsg.msg"
DEPENDENCIES geometry_msgs std_msgs sensor_msgs visualization_msgs nav_msgs
)

# Ensure generated message headers are visible to targets in this package
include_directories(${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_cpp)

# Provide the rosidl fastrtps C++ typesupport target for linking against the
# generated type support library for this package's messages.
## Link helper that prefers the generated FastRTPS C++ typesupport target for
## this package, but falls back to the introspection C++ typesupport if the
## fastrtps target isn't available. The generated target names use the
## convention: <pkg>__rosidl_typesupport_fastrtps_cpp.
## Candidate package-specific rosidl typesupport targets. Use generator
## expressions so CMake will link whichever one was generated for this
## package (fastrtps, introspection, or the generic cpp typesupport).
set(UT_AUTOMATA_TYPESUPPORT_LINK
$<TARGET_NAME_IF_EXISTS:${PROJECT_NAME}__rosidl_typesupport_fastrtps_cpp>
$<TARGET_NAME_IF_EXISTS:${PROJECT_NAME}__rosidl_typesupport_introspection_cpp>
$<TARGET_NAME_IF_EXISTS:${PROJECT_NAME}__rosidl_typesupport_cpp>
)

ADD_SUBDIRECTORY(src/shared)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/shared)

SET(libs roslib roscpp glog gflags amrl_shared_lib
${BUILD_SPECIFIC_LIBRARIES} rosbag X11 lua5.1 boost_system)
SET(libs glog gflags amrl_shared_lib
${BUILD_SPECIFIC_LIBRARIES} X11 lua5.1 boost_system)

IF(${CMAKE_BUILD_MODE} MATCHES "Hardware")
MESSAGE(STATUS "Building hardware drivers")
rosbuild_add_executable(vesc_driver
src/vesc_driver/serial.cc
src/vesc_driver/vesc_driver_node.cpp
src/vesc_driver/vesc_driver.cpp
src/vesc_driver/vesc_interface.cpp
src/vesc_driver/vesc_packet.cpp
src/vesc_driver/vesc_packet_factory.cpp)
target_link_libraries(vesc_driver ${libs})

ROSBUILD_ADD_EXECUTABLE(gui

add_executable(vesc_driver
src/vesc_driver/serial.cc
src/vesc_driver/vesc_driver_node.cpp
src/vesc_driver/vesc_driver.cpp
src/vesc_driver/vesc_interface.cpp
src/vesc_driver/vesc_packet.cpp
src/vesc_driver/vesc_packet_factory.cpp)
ament_target_dependencies(vesc_driver rclcpp std_msgs geometry_msgs nav_msgs sensor_msgs amrl_msgs rosidl_default_runtime)
target_include_directories(vesc_driver PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_cpp>)
target_link_libraries(vesc_driver ${libs} ${UT_AUTOMATA_TYPESUPPORT_LINK})

add_executable(gui
src/gui/gui_main.cc
src/gui/gui_mainwindow.cc
src/gui/vector_display.cc
${GUI_MOC_SRCS})
ament_target_dependencies(gui rclcpp std_msgs geometry_msgs nav_msgs sensor_msgs amrl_msgs cv_bridge OpenCV rosidl_default_runtime)
target_include_directories(gui PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_cpp>)
TARGET_LINK_LIBRARIES(gui
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::OpenGL
${libs} ${OPENGL_LIBRARY} GL)
${OpenCV_LIBS}
${libs} ${OPENGL_LIBRARY} GL ${UT_AUTOMATA_TYPESUPPORT_LINK})

ROSBUILD_ADD_EXECUTABLE(joystick
add_executable(joystick
src/joystick/joystick.cc
src/joystick/joystick_driver.cc)
TARGET_LINK_LIBRARIES(joystick ${libs})
ament_target_dependencies(joystick rclcpp std_msgs geometry_msgs nav_msgs sensor_msgs amrl_msgs rosidl_default_runtime)
target_include_directories(joystick PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_cpp>)
target_link_libraries(joystick ${libs} ${UT_AUTOMATA_TYPESUPPORT_LINK})

# Install hardware executables for ROS 2
install(TARGETS
vesc_driver
gui
joystick
DESTINATION lib/${PROJECT_NAME})
ENDIF()

MESSAGE(STATUS "Building simulator")

ROSBUILD_ADD_EXECUTABLE(simulator
add_executable(simulator
src/simulator/simulator.cc
src/simulator/vector_map.cc
src/simulator/simulator_main.cc)
TARGET_LINK_LIBRARIES(simulator ${libs})
ament_target_dependencies(simulator rclcpp ament_index_cpp std_msgs geometry_msgs nav_msgs sensor_msgs visualization_msgs amrl_msgs tf2 tf2_geometry_msgs tf2_ros rosidl_default_runtime)
target_include_directories(simulator PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_cpp>)
target_link_libraries(simulator ${libs} ${UT_AUTOMATA_TYPESUPPORT_LINK})

ROSBUILD_ADD_EXECUTABLE(step_simulator
add_executable(step_simulator
src/simulator/simulator.cc
src/simulator/vector_map.cc
src/simulator/step_simulator_main.cc)
TARGET_LINK_LIBRARIES(step_simulator ${libs})
ament_target_dependencies(step_simulator rclcpp ament_index_cpp std_msgs geometry_msgs nav_msgs sensor_msgs visualization_msgs amrl_msgs tf2 tf2_geometry_msgs tf2_ros rosidl_default_runtime)
target_include_directories(step_simulator PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_cpp>)
target_link_libraries(step_simulator ${libs} ${UT_AUTOMATA_TYPESUPPORT_LINK})

ROSBUILD_ADD_EXECUTABLE(websocket
add_executable(websocket
src/websocket/websocket_main.cc
src/websocket/websocket.cc
)
TARGET_LINK_LIBRARIES(websocket
ament_target_dependencies(websocket rclcpp ament_index_cpp std_msgs geometry_msgs nav_msgs sensor_msgs amrl_msgs rosidl_default_runtime)
target_include_directories(websocket PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_cpp>)
target_link_libraries(websocket
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::WebSockets
${libs})
${libs} ${UT_AUTOMATA_TYPESUPPORT_LINK})

# Install executables for ROS 2
install(TARGETS
simulator
step_simulator
websocket
DESTINATION lib/${PROJECT_NAME})

# Copy simulator configs
install(DIRECTORY
config
DESTINATION share/${PROJECT_NAME}
OPTIONAL)

# ROS 2 package finalization
# Install launch files, config files, etc.
install(DIRECTORY
launch
config
DESTINATION share/${PROJECT_NAME}
OPTIONAL)

ament_export_dependencies(rosidl_default_runtime)
ament_package()

# Generate car.lua from the hostname at build time and install it.
# The generated file will be written to the build tree and then installed
# into share/${PROJECT_NAME}/config/car.lua so it ends up at
# $(ros2 pkg prefix ut_automata)/share/ut_automata/config/car.lua
set(GENERATED_CAR_LUA ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/config/car.lua)

add_custom_command(
OUTPUT ${GENERATED_CAR_LUA}
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/config
COMMAND /bin/sh -c "hn=$(hostname); num=$(echo \"${hn}\" | grep -oE '[0-9]+' | tail -n1); if [ -z \"${num}\" ]; then num=0; fi; printf 'car_name = \"car%s\";\\n' \"${num}\" > \"${GENERATED_CAR_LUA}\""

Copilot AI Oct 25, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Complex shell command embedded in CMakeLists.txt is difficult to read and maintain. Consider extracting this logic into a separate script file for better maintainability.

Copilot uses AI. Check for mistakes.
COMMENT "Generating ${GENERATED_CAR_LUA} from hostname"
VERBATIM
)

add_custom_target(generate_car_lua ALL DEPENDS ${GENERATED_CAR_LUA})

# Install the generated file into the package share directory so it's available
# after 'colcon build' under $(ros2 pkg prefix ut_automata)/share/ut_automata/config/car.lua
install(FILES ${GENERATED_CAR_LUA} DESTINATION share/${PROJECT_NAME}/config)
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
build_type=Release
# build_type=Debug
#acceptable build_mode: Simulation/Hardware
build_mode=Simulation
build_mode=Hardware

.SILENT:

Expand Down
12 changes: 9 additions & 3 deletions config/joystick.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
joystick_port="/dev/input/js1"
joystick_port="/dev/input/js0"

-- name of controller used
joystick_name="Logitech_F710"
-- joystick_name="Sony_DualShock_4"
-- joystick_name="Logitech_F710"
joystick_name="Sony_DualShock_4"

-- Joystick control mode configuration
-- "both": left stick horizontal for steering, right stick vertical for drive (default)
-- "left": left stick only (horizontal for steering, vertical for drive)
-- "right": right stick only (horizontal for steering, vertical for drive)
joystick_mode = "both"



Expand Down
21 changes: 0 additions & 21 deletions launch/hokuyo_10lx.launch

This file was deleted.

Loading