diff --git a/mission/joystick_interface/CMakeLists.txt b/mission/joystick_interface/CMakeLists.txt new file mode 100644 index 00000000..751a5b72 --- /dev/null +++ b/mission/joystick_interface/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.8) +project(joystick_interface) + +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) +# uncomment the following section in order to fill in +# further dependencies manually. +# find_package( REQUIRED) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # comment the line when a copyright and license is added to all source files + set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # comment the line when this package is in a git repo and when + # a copyright and license is added to all source files + set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +ament_package() diff --git a/mission/joystick_interface/package.xml b/mission/joystick_interface/package.xml new file mode 100644 index 00000000..4b61f1f9 --- /dev/null +++ b/mission/joystick_interface/package.xml @@ -0,0 +1,18 @@ + + + + joystick_interface + 0.0.0 + Joystick interface package + aleksos + MIT + + ament_cmake + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/mission/joystick_interface/scripts/__init__.py b/mission/joystick_interface/scripts/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/mission/joystick_interface/scripts/joystick_interface.py b/mission/joystick_interface/scripts/joystick_interface.py new file mode 100644 index 00000000..7f78170b --- /dev/null +++ b/mission/joystick_interface/scripts/joystick_interface.py @@ -0,0 +1,13 @@ +from geometry_msgs.msg import Wrench + +class JoystickInterface: + def __init__(self): + self.wrench_pub + + def create_2d_wrench_message(self,x,y,yaw): + wrench_msg = Wrench() + wrench_msg.force.x = x + wrench_msg.force.y = y + wrench_msg.torque.z = yaw + return wrench_msg + diff --git a/mission/joystick_interface/scripts/test/__init__.py b/mission/joystick_interface/scripts/test/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/mission/joystick_interface/scripts/test/test_joystick_interface.py b/mission/joystick_interface/scripts/test/test_joystick_interface.py new file mode 100644 index 00000000..e87a2740 --- /dev/null +++ b/mission/joystick_interface/scripts/test/test_joystick_interface.py @@ -0,0 +1,9 @@ +from scripts.joystick_interface import JoystickInterface +from geometry_msgs.msg import Wrench + +class TestJoystickInterface: + def test_2d_wrench_msg(self): + msg = JoystickInterface().create_2d_wrench_message(2.0, 3.0, 4.0) + assert msg.force.x == 2.0 + assert msg.force.y == 3.0 + assert msg.torque.z == 4.0