Skip to content

Commit 81d4ad5

Browse files
committed
remove old launch files, configure the joystick defaults and add a car config on installation
1 parent 222c1f2 commit 81d4ad5

5 files changed

Lines changed: 24 additions & 66 deletions

File tree

CMakeLists.txt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CMAKE_MINIMUM_REQUIRED(VERSION 3.8)
1+
CMAKE_MINIMUM_REQUIRED(VERSION 3.14.4)
22
PROJECT(ut_automata)
33

44
set(CMAKE_CXX_STANDARD 17)
@@ -208,3 +208,23 @@ install(DIRECTORY
208208

209209
ament_export_dependencies(rosidl_default_runtime)
210210
ament_package()
211+
212+
# Generate car.lua from the hostname at build time and install it.
213+
# The generated file will be written to the build tree and then installed
214+
# into share/${PROJECT_NAME}/config/car.lua so it ends up at
215+
# $(ros2 pkg prefix ut_automata)/share/ut_automata/config/car.lua
216+
set(GENERATED_CAR_LUA ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/config/car.lua)
217+
218+
add_custom_command(
219+
OUTPUT ${GENERATED_CAR_LUA}
220+
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/config
221+
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}\""
222+
COMMENT "Generating ${GENERATED_CAR_LUA} from hostname"
223+
VERBATIM
224+
)
225+
226+
add_custom_target(generate_car_lua ALL DEPENDS ${GENERATED_CAR_LUA})
227+
228+
# Install the generated file into the package share directory so it's available
229+
# after 'colcon build' under $(ros2 pkg prefix ut_automata)/share/ut_automata/config/car.lua
230+
install(FILES ${GENERATED_CAR_LUA} DESTINATION share/${PROJECT_NAME}/config)

config/joystick.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
joystick_port="/dev/input/js1"
1+
joystick_port="/dev/input/js0"
22

33
-- name of controller used
4-
joystick_name="Logitech_F710"
5-
-- joystick_name="Sony_DualShock_4"
4+
-- joystick_name="Logitech_F710"
5+
joystick_name="Sony_DualShock_4"
66

77

88

launch/hokuyo_10lx.launch

Lines changed: 0 additions & 21 deletions
This file was deleted.

launch/logging.launch

Lines changed: 0 additions & 3 deletions
This file was deleted.

launch/start_car.launch

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)