diff --git a/asv_setup/launch/pc.yaml b/asv_setup/launch/pc.yaml index 16f4cebf..d65bd83f 100644 --- a/asv_setup/launch/pc.yaml +++ b/asv_setup/launch/pc.yaml @@ -20,4 +20,4 @@ launch: to: "/joystick/joy" - include: - file: "vortex-asv/mission/joystick_interface/launch/joystick_interface_launch.yaml" + file: "src/vortex-asv/mission/joystick_interface/launch/joystick_interface_launch.yaml" diff --git a/mission/joystick_interface/CMakeLists.txt b/mission/joystick_interface/CMakeLists.txt index 9d0dd660..0f5262d4 100644 --- a/mission/joystick_interface/CMakeLists.txt +++ b/mission/joystick_interface/CMakeLists.txt @@ -5,18 +5,11 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic) endif() -# find dependencies -#find_package(ament_cmake REQUIRED) find_package(ament_cmake_python REQUIRED) - -# uncomment the following section in order to fill in -# further dependencies manually. -# find_package( REQUIRED) find_package(rclpy REQUIRED) find_package(sensor_msgs REQUIRED) find_package(geometry_msgs REQUIRED) -#ament_python_install_package("joystick_interface") ament_python_install_package(${PROJECT_NAME}) install(PROGRAMS @@ -24,12 +17,10 @@ install(PROGRAMS DESTINATION lib/${PROJECT_NAME} ) - if(BUILD_TESTING) find_package(ament_cmake_pytest REQUIRED) set(_pytest_tests joystick_interface/test/test_joystick_interface.py - # Add other test files here ) foreach(_test_path ${_pytest_tests}) get_filename_component(_test_name ${_test_path} NAME_WE) diff --git a/mission/joystick_interface/README.md b/mission/joystick_interface/README.md new file mode 100644 index 00000000..61f7b0b4 --- /dev/null +++ b/mission/joystick_interface/README.md @@ -0,0 +1,2 @@ +In the launch files we need to make it able to find the yaml files without having an explicit path such as this: "src/vortex-asv/mission/joystick_interface/launch/joystick_interface_launch.yaml" +Perhaps change to python launch diff --git a/mission/joystick_interface/config/params.yaml b/mission/joystick_interface/config/params.yaml index e86ec0e0..45d9bbd6 100644 --- a/mission/joystick_interface/config/params.yaml +++ b/mission/joystick_interface/config/params.yaml @@ -1,7 +1,7 @@ -/joystick_interface: +joystick_interface: ros__parameters: - surge: 50.0 - sway: 50.0 - yaw: 50.0 + surge_scale_factor: 50.0 + sway_scale_factor: 50.0 + yaw_scale_factor: 50.0 diff --git a/mission/joystick_interface/joystick_interface/joystick_interface.py b/mission/joystick_interface/joystick_interface/joystick_interface.py index 78a5f35d..5640b02e 100755 --- a/mission/joystick_interface/joystick_interface/joystick_interface.py +++ b/mission/joystick_interface/joystick_interface/joystick_interface.py @@ -47,36 +47,36 @@ def __init__(self): "dpad_vertical", ] - self.joy_subscriber = self.create_subscription(Joy, "/joystick/joy", + self.joy_subscriber = self.create_subscription(Joy, "joystick/joy", self.joystick_cb, 1) self.wrench_publisher = self.create_publisher(Wrench, - "/thrust/wrench_input", + "thrust/wrench_input", 1) - self.declare_parameter('surge', 100.0) - self.declare_parameter('sway', 100.0) - self.declare_parameter('yaw', 100.0) + self.declare_parameter('surge_scale_factor', 100.0) + self.declare_parameter('sway_scale_factor', 100.0) + self.declare_parameter('yaw_scale_factor', 100.0) #Gets the scaling factors from the yaml file - self.joystick_surge_scaling = self.get_parameter('surge').value - self.joystick_sway_scaling = self.get_parameter('sway').value - self.joystick_yaw_scaling = self.get_parameter('yaw').value + self.joystick_surge_scaling = self.get_parameter('surge_scale_factor').value + self.joystick_sway_scaling = self.get_parameter('sway_scale_factor').value + self.joystick_yaw_scaling = self.get_parameter('yaw_scale_factor').value #Killswitch publisher self.software_killswitch_signal_publisher = self.create_publisher( - Bool, "/softWareKillSwitch", 10) + Bool, "softWareKillSwitch", 10) self.software_killswitch_signal_publisher.publish( Bool(data=False)) #Killswitch is not active #Operational mode publisher self.operational_mode_signal_publisher = self.create_publisher( - Bool, "/softWareOperationMode", 10) + Bool, "softWareOperationMode", 10) # Signal that we are not in autonomous mode self.operational_mode_signal_publisher.publish(Bool(data=True)) #Controller publisher self.enable_controller_publisher = self.create_publisher( - Bool, "/controller/lqr/enable", 10) + Bool, "controller/lqr/enable", 10) #does a linear conversion from trigger inputs (1 to -1) to (1 to 2) def right_trigger_linear_converter(self, rt_input): diff --git a/mission/joystick_interface/launch/joystick_interface_launch.yaml b/mission/joystick_interface/launch/joystick_interface_launch.yaml index e52aa61d..61aac95f 100644 --- a/mission/joystick_interface/launch/joystick_interface_launch.yaml +++ b/mission/joystick_interface/launch/joystick_interface_launch.yaml @@ -5,7 +5,8 @@ launch: name: joystick_interface output: screen param: - - from: vortex-asv/mission/joystick_interface/config/params.yaml + - from: src/vortex-asv/mission/joystick_interface/config/params.yaml +