diff --git a/auv_setup/CMakeLists.txt b/auv_setup/CMakeLists.txt index 39183f94d..ae1fe2d7e 100644 --- a/auv_setup/CMakeLists.txt +++ b/auv_setup/CMakeLists.txt @@ -1,2 +1,24 @@ -cmake_minimum_required(VERSION 3.0.2) +cmake_minimum_required(VERSION 3.8) project(auv_setup) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + set(ament_cmake_copyright_FOUND TRUE) + set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +# Install launch files. +install(DIRECTORY + config + launch + DESTINATION share/${PROJECT_NAME}/ +) + +ament_package() diff --git a/auv_setup/launch/pc.launch.py b/auv_setup/launch/pc.launch.py new file mode 100644 index 000000000..bf801d62e --- /dev/null +++ b/auv_setup/launch/pc.launch.py @@ -0,0 +1,42 @@ +import os +from launch import LaunchDescription +from launch.actions import SetEnvironmentVariable, IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch_ros.actions import Node +from ament_index_python.packages import get_package_share_directory + +def generate_launch_description(): + # Set environment variable + set_env_var = SetEnvironmentVariable( + name='ROSCONSOLE_FORMAT', + value='[${severity}] [${time}] [${node}]: ${message}' + ) + + # Joystick node + joy_node = Node( + package='joy', + executable='joy_node', + name='joystick_driver', + output='screen', + parameters=[ + {'deadzone': 0.15}, + {'autorepeat_rate': 100.0}, + ], + remappings=[ + ('/joy', '/joystick/joy'), + ], + ) + + # Joystick interface launch + joystick_interface_launch = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('joystick_interface_auv'), 'launch/joystick_interface_auv.launch.py') + ) + ) + + # Return launch description + return LaunchDescription([ + set_env_var, + joy_node, + joystick_interface_launch + ]) diff --git a/auv_setup/package.xml b/auv_setup/package.xml index e99f74b90..b9099a0cd 100644 --- a/auv_setup/package.xml +++ b/auv_setup/package.xml @@ -1,11 +1,18 @@ - + + auv_setup 0.0.0 The auv_setup package - christopher + alekskl01 MIT - catkin + ament_cmake - + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/mission/joystick_interface_auv/scripts/joystick_interface_auv.py b/mission/joystick_interface_auv/scripts/joystick_interface_auv.py index 624fc3b3c..b8cc97336 100644 --- a/mission/joystick_interface_auv/scripts/joystick_interface_auv.py +++ b/mission/joystick_interface_auv/scripts/joystick_interface_auv.py @@ -170,20 +170,12 @@ def joystick_cb(self, msg: Joy): left_shoulder = buttons["LB"] right_shoulder = buttons["RB"] -<<<<<<< HEAD surge = axes[ "vertical_axis_left_stick"] * self.joystick_surge_scaling_ sway = axes[ "horizontal_axis_left_stick"] * self.joystick_sway_scaling_ heave = -(left_trigger - right_trigger)/2 * self.joystick_heave_scaling_ roll = (right_shoulder - left_shoulder) * self.joystick_roll_scaling_ -======= - surge = axes["vertical_axis_left_stick"] * self.joystick_surge_scaling_ - sway = axes["horizontal_axis_left_stick"] * self.joystick_sway_scaling_ - heave = -(axes[["RT"] - axes["LT"]]) / 2 * self.joystick_heave_scaling_ - roll = axes[self.buttons["RB"] - - self.buttons["LB"]] * self.joystick_roll_scaling_ ->>>>>>> refs/remotes/origin/feature/joystick_interface_in_ros2 pitch = -axes[ "vertical_axis_right_stick"] * self.joystick_pitch_scaling_ yaw = axes["horizontal_axis_right_stick"] * self.joystick_yaw_scaling_