From c392a6090fa0e07e8dca71a8b7dff0a73f0924a6 Mon Sep 17 00:00:00 2001 From: uquzq <ventsi@DESKTOP-J41TDPJ> Date: Thu, 4 Jul 2024 15:22:18 +0200 Subject: [PATCH] Add launch file for the 1dof simulation --- .../launch/forward_kinematics_1dof_launch.py | 39 ++++++++++++++++ .../rviz/forward_kinematics_simulations.rviz} | 44 +++++++++---------- ros2_ws/src/simple_robot_1dof/setup.py | 8 +++- 3 files changed, 67 insertions(+), 24 deletions(-) create mode 100644 ros2_ws/src/simple_robot_1dof/launch/forward_kinematics_1dof_launch.py rename ros2_ws/src/{to.rviz => simple_robot_1dof/rviz/forward_kinematics_simulations.rviz} (96%) diff --git a/ros2_ws/src/simple_robot_1dof/launch/forward_kinematics_1dof_launch.py b/ros2_ws/src/simple_robot_1dof/launch/forward_kinematics_1dof_launch.py new file mode 100644 index 0000000..fc9a782 --- /dev/null +++ b/ros2_ws/src/simple_robot_1dof/launch/forward_kinematics_1dof_launch.py @@ -0,0 +1,39 @@ +import os +from launch import LaunchDescription +from launch_ros.actions import Node +from launch.actions import ExecuteProcess +from ament_index_python.packages import get_package_share_directory + +def generate_launch_description(): + + package_name = 'simple_robot_1dof' + + rviz_config_file = os.path.join( + get_package_share_directory(package_name), + 'rviz', + 'forward_kinematics_simulations.rviz' + ) + + return LaunchDescription([ + Node( + package = package_name, + executable = 'forward_kinematics_node_1dof', + name = 'forward_kinematics_node', + output = 'screen', + parameters = [] + ), + Node( + package = package_name, + executable = 'reference_node_1dof', + name = 'reference_node', + output = 'screen', + parameters = [] + ), + Node( + package='rviz2', + executable='rviz2', + name='rviz2', + output='screen', + arguments=['-d', rviz_config_file] + ) + ]) \ No newline at end of file diff --git a/ros2_ws/src/to.rviz b/ros2_ws/src/simple_robot_1dof/rviz/forward_kinematics_simulations.rviz similarity index 96% rename from ros2_ws/src/to.rviz rename to ros2_ws/src/simple_robot_1dof/rviz/forward_kinematics_simulations.rviz index 7614e63..27a4368 100644 --- a/ros2_ws/src/to.rviz +++ b/ros2_ws/src/simple_robot_1dof/rviz/forward_kinematics_simulations.rviz @@ -6,9 +6,9 @@ Panels: Expanded: - /Global Options1 - /Status1 + - /Path1 - /Marker1 - /Marker1/Topic1 - - /Path1 Splitter Ratio: 0.5 Tree Height: 696 - Class: rviz_common/Selection @@ -50,19 +50,6 @@ Visualization Manager: Plane Cell Count: 10 Reference Frame: <Fixed Frame> Value: true - - Class: rviz_default_plugins/Marker - Enabled: true - Name: Marker - Namespaces: - "": true - Topic: - Depth: 5 - Durability Policy: Volatile - Filter size: 10 - History Policy: Keep Last - Reliability Policy: Reliable - Value: /simple_robot/visualization_marker - Value: true - Alpha: 1 Buffer Length: 1 Class: rviz_default_plugins/Path @@ -91,6 +78,19 @@ Visualization Manager: Reliability Policy: Reliable Value: /simple_robot/visualization_path Value: true + - Class: rviz_default_plugins/Marker + Enabled: true + Name: Marker + Namespaces: + "": true + Topic: + Depth: 5 + Durability Policy: Volatile + Filter size: 10 + History Policy: Keep Last + Reliability Policy: Reliable + Value: /simple_robot/visualization_marker + Value: true Enabled: true Global Options: Background Color: 48; 48; 48 @@ -137,25 +137,25 @@ Visualization Manager: Views: Current: Class: rviz_default_plugins/Orbit - Distance: 6.6957197189331055 + Distance: 4.086756229400635 Enable Stereo Rendering: Stereo Eye Separation: 0.05999999865889549 Stereo Focal Distance: 1 Swap Stereo Eyes: false Value: false Focal Point: - X: -0.861002504825592 - Y: 0.12668320536613464 - Z: 0.19602636992931366 + X: 0 + Y: 0 + Z: 0 Focal Shape Fixed Size: true Focal Shape Size: 0.05000000074505806 Invert Z Axis: false Name: Current View Near Clip Distance: 0.009999999776482582 - Pitch: 1.2197964191436768 + Pitch: 1.5697963237762451 Target Frame: <Fixed Frame> Value: Orbit (rviz) - Yaw: 4.693583011627197 + Yaw: 4.688580513000488 Saved: ~ Window Geometry: Displays: @@ -173,5 +173,5 @@ Window Geometry: Views: collapsed: false Width: 1908 - X: -75 - Y: -25 + X: 0 + Y: 0 diff --git a/ros2_ws/src/simple_robot_1dof/setup.py b/ros2_ws/src/simple_robot_1dof/setup.py index 9eef448..6a1eb2f 100644 --- a/ros2_ws/src/simple_robot_1dof/setup.py +++ b/ros2_ws/src/simple_robot_1dof/setup.py @@ -10,6 +10,8 @@ setup( ('share/ament_index/resource_index/packages', ['resource/' + package_name]), ('share/' + package_name, ['package.xml']), + ('share/' + package_name + '/launch', ['launch/forward_kinematics_1dof_launch.py']), + ('share/' + package_name + '/rviz', ['rviz/forward_kinematics_simulations.rviz']), ], install_requires=['setuptools'], zip_safe=True, @@ -20,8 +22,10 @@ setup( tests_require=['pytest'], entry_points={ 'console_scripts': [ - 'publisher = simple_robot_1dof.reference_node_1dof:main', - 'subscriber = simple_robot_1dof.forward_kinematics_node_1dof:main', + #'publisher = simple_robot_1dof.reference_node_1dof:main', + #'subscriber = simple_robot_1dof.forward_kinematics_node_1dof:main', + 'forward_kinematics_node_1dof = simple_robot_1dof.forward_kinematics_node_1dof:main', + 'reference_node_1dof = simple_robot_1dof.reference_node_1dof:main', ], }, ) -- GitLab