diff --git a/ros2_ws/.vscode/c_cpp_properties.json b/ros2_ws/.vscode/c_cpp_properties.json new file mode 100644 index 0000000000000000000000000000000000000000..d3a36710a1e87bb47ec34f667fa85c20bb7a8a70 --- /dev/null +++ b/ros2_ws/.vscode/c_cpp_properties.json @@ -0,0 +1,26 @@ +{ + "configurations": [ + { + "browse": { + "databaseFilename": "${default}", + "limitSymbolsToIncludedHeaders": false + }, + "includePath": [ + "/home/ventsi/trajektorien-des-menschlichen-aufstehens-fuer-die-entwicklung-eines-kooperativen-assistenzsystems/ros2_ws/install/impedance_controller/include/**", + "/home/ventsi/trajektorien-des-menschlichen-aufstehens-fuer-die-entwicklung-eines-kooperativen-assistenzsystems/ros2_ws/install/iiwa_hardware/include/**", + "/home/ventsi/trajektorien-des-menschlichen-aufstehens-fuer-die-entwicklung-eines-kooperativen-assistenzsystems/ros2_ws/install/external_torque_sensor_broadcaster/include/**", + "/opt/ros/humble/include/**", + "/home/ventsi/trajektorien-des-menschlichen-aufstehens-fuer-die-entwicklung-eines-kooperativen-assistenzsystems/ros2_ws/src/iiwa/iiwa_controllers/external_torque_sensor_broadcaster/include/**", + "/home/ventsi/trajektorien-des-menschlichen-aufstehens-fuer-die-entwicklung-eines-kooperativen-assistenzsystems/ros2_ws/src/iiwa/iiwa_controllers/impedance_controller/include/**", + "/home/ventsi/trajektorien-des-menschlichen-aufstehens-fuer-die-entwicklung-eines-kooperativen-assistenzsystems/ros2_ws/src/iiwa/iiwa_hardware/include/**", + "/usr/include/**" + ], + "name": "ROS", + "intelliSenseMode": "gcc-x64", + "compilerPath": "/usr/bin/gcc", + "cStandard": "gnu11", + "cppStandard": "c++14" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/ros2_ws/.vscode/settings.json b/ros2_ws/.vscode/settings.json new file mode 100644 index 0000000000000000000000000000000000000000..a5d34f69e2c3fc582fa248ffed8483f5c492df4c --- /dev/null +++ b/ros2_ws/.vscode/settings.json @@ -0,0 +1,18 @@ +{ + "python.autoComplete.extraPaths": [ + "/home/ventsi/trajektorien-des-menschlichen-aufstehens-fuer-die-entwicklung-eines-kooperativen-assistenzsystems/ros2_ws/install/simple_robot_3dof/lib/python3.10/site-packages", + "/home/ventsi/trajektorien-des-menschlichen-aufstehens-fuer-die-entwicklung-eines-kooperativen-assistenzsystems/ros2_ws/install/simple_robot_2dof/lib/python3.10/site-packages", + "/home/ventsi/trajektorien-des-menschlichen-aufstehens-fuer-die-entwicklung-eines-kooperativen-assistenzsystems/ros2_ws/install/simple_robot_1dof/lib/python3.10/site-packages", + "/home/ventsi/trajektorien-des-menschlichen-aufstehens-fuer-die-entwicklung-eines-kooperativen-assistenzsystems/ros2_ws/install/iiwa_inverse_kinematics/lib/python3.10/site-packages", + "/opt/ros/humble/lib/python3.10/site-packages", + "/opt/ros/humble/local/lib/python3.10/dist-packages" + ], + "python.analysis.extraPaths": [ + "/home/ventsi/trajektorien-des-menschlichen-aufstehens-fuer-die-entwicklung-eines-kooperativen-assistenzsystems/ros2_ws/install/simple_robot_3dof/lib/python3.10/site-packages", + "/home/ventsi/trajektorien-des-menschlichen-aufstehens-fuer-die-entwicklung-eines-kooperativen-assistenzsystems/ros2_ws/install/simple_robot_2dof/lib/python3.10/site-packages", + "/home/ventsi/trajektorien-des-menschlichen-aufstehens-fuer-die-entwicklung-eines-kooperativen-assistenzsystems/ros2_ws/install/simple_robot_1dof/lib/python3.10/site-packages", + "/home/ventsi/trajektorien-des-menschlichen-aufstehens-fuer-die-entwicklung-eines-kooperativen-assistenzsystems/ros2_ws/install/iiwa_inverse_kinematics/lib/python3.10/site-packages", + "/opt/ros/humble/lib/python3.10/site-packages", + "/opt/ros/humble/local/lib/python3.10/dist-packages" + ] +} \ No newline at end of file diff --git a/ros2_ws/src/simple_robot_1dof/launch/kuka_rviz_simulation_1dof_launch.py b/ros2_ws/src/simple_robot_1dof/launch/kuka_rviz_simulation_1dof_launch.py index ce6d5890983a2976cb0d5ffb0bb236ad2dc70abb..10ce2348917a0ea1e011d0f943849f5aa425a21a 100644 --- a/ros2_ws/src/simple_robot_1dof/launch/kuka_rviz_simulation_1dof_launch.py +++ b/ros2_ws/src/simple_robot_1dof/launch/kuka_rviz_simulation_1dof_launch.py @@ -16,6 +16,17 @@ def generate_launch_description(): 'forward_kinematics_simulations.rviz' ) + # rviz_config_file_urdf = os.path.join( + # get_package_share_directory(package_name), + # 'rviz', + # 'urdf.rviz' + # ) + + urdf_dir = os.path.join(get_package_share_directory(package_name), 'urdf') + urdf_file = os.path.join(urdf_dir, 'simple_robot.urdf') + with open(urdf_file, 'r') as infp: + robot_desc = infp.read() + declared_arguments = [] declared_arguments.append( DeclareLaunchArgument( @@ -82,6 +93,13 @@ def generate_launch_description(): output='screen', arguments=['-d', rviz_config_file] ) + # rviz_node_urdf = Node( + # package='rviz2', + # executable='rviz2', + # name='rviz2', + # output='screen', + # arguments=['-d', rviz_config_file_urdf] + # ) inverse_kinematics_node = Node( package= 'iiwa_inverse_kinematics', executable='inverse_kinematics_node', @@ -89,11 +107,35 @@ def generate_launch_description(): output='screen', parameters = [] ) + robot_state_publisher = Node( + package='robot_state_publisher', + executable='robot_state_publisher', + output='both', + parameters=[ + {'robot_description': robot_desc} + ] + ) + joint_state_publisher = Node( + package='joint_state_publisher', + executable='joint_state_publisher', + output = 'both', + # parameters=[params] + ) + joint_state_publisher_gui = Node( + package='joint_state_publisher_gui', + executable='joint_state_publisher_gui', + name='joint_state_publisher_gui', + output='screen', + ) nodes = [ forward_kinematics_node, reference_node, rviz_node, - inverse_kinematics_node + # rviz_node_urdf, + inverse_kinematics_node, + robot_state_publisher, + joint_state_publisher, + joint_state_publisher_gui ] return LaunchDescription(declared_arguments + nodes) \ No newline at end of file diff --git a/ros2_ws/src/simple_robot_1dof/package.xml b/ros2_ws/src/simple_robot_1dof/package.xml index 62fe77b7e2840b60d2e87edc54471d64a55ef914..a1efe732f0c7906e5c73a440146318793932e574 100644 --- a/ros2_ws/src/simple_robot_1dof/package.xml +++ b/ros2_ws/src/simple_robot_1dof/package.xml @@ -7,6 +7,23 @@ <maintainer email="ventsi@todo.todo">ventsi</maintainer> <license>Apache-2.0</license> + <depend>rclpy</depend> + <depend>robot_state_publisher</depend> + <depend>rviz2</depend> + <depend>joint_state_publisher_gui</depend> + + <depend>builtin_interfaces</depend> + <depend>geometry_msgs</depend> + <depend>kdl_parser</depend> + <depend>orocos_kdl_vendor</depend> + <depend>rcl_interfaces</depend> + <depend>rclcpp</depend> + <depend>rclcpp_components</depend> + <depend>sensor_msgs</depend> + <depend>std_msgs</depend> + <depend>tf2_ros</depend> + <depend>urdf</depend> + <test_depend>ament_copyright</test_depend> <test_depend>ament_flake8</test_depend> <test_depend>ament_pep257</test_depend> diff --git a/ros2_ws/src/simple_robot_1dof/rviz/forward_kinematics_simulations.rviz:Zone.Identifier b/ros2_ws/src/simple_robot_1dof/rviz/forward_kinematics_simulations.rviz:Zone.Identifier deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/ros2_ws/src/simple_robot_1dof/rviz/urdf.rviz b/ros2_ws/src/simple_robot_1dof/rviz/urdf.rviz new file mode 100644 index 0000000000000000000000000000000000000000..424e079802ec0c80a81328803903c91d56b31cf0 --- /dev/null +++ b/ros2_ws/src/simple_robot_1dof/rviz/urdf.rviz @@ -0,0 +1,206 @@ +Panels: + - Class: rviz_common/Displays + Help Height: 138 + Name: Displays + Property Tree Widget: + Expanded: + - /Global Options1 + - /Status1 + - /RobotModel1 + Splitter Ratio: 0.5 + Tree Height: 340 + - Class: rviz_common/Selection + Name: Selection + - Class: rviz_common/Tool Properties + Expanded: + - /2D Goal Pose1 + - /Publish Point1 + Name: Tool Properties + Splitter Ratio: 0.5886790156364441 + - Class: rviz_common/Views + Expanded: + - /Current View1 + Name: Views + Splitter Ratio: 0.5 + - Class: rviz_common/Time + Experimental: false + Name: Time + SyncMode: 0 + SyncSource: "" +Visualization Manager: + Class: "" + Displays: + - Alpha: 0.5 + Cell Size: 1 + Class: rviz_default_plugins/Grid + Color: 160; 160; 164 + Enabled: true + Line Style: + Line Width: 0.029999999329447746 + Value: Lines + Name: Grid + Normal Cell Count: 0 + Offset: + X: 0 + Y: 0 + Z: 0 + Plane: XY + Plane Cell Count: 10 + Reference Frame: <Fixed Frame> + Value: true + - Alpha: 1 + Class: rviz_default_plugins/RobotModel + Collision Enabled: false + Description File: "" + Description Source: Topic + Description Topic: + Depth: 5 + Durability Policy: Volatile + History Policy: Keep Last + Reliability Policy: Reliable + Value: /robot_description + Enabled: true + Links: + All Links Enabled: true + Expand Joint Details: false + Expand Link Details: false + Expand Tree: false + Link Tree Style: Links in Alphabetic Order + arm1: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + arm2: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + arm3: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + base_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + Mass Properties: + Inertia: false + Mass: false + Name: RobotModel + TF Prefix: "" + Update Interval: 0 + Value: true + Visual Enabled: true + - Class: rviz_default_plugins/TF + Enabled: true + Frame Timeout: 15 + Frames: + All Enabled: true + arm1: + Value: true + arm2: + Value: true + arm3: + Value: true + base_link: + Value: true + Marker Scale: 1 + Name: TF + Show Arrows: true + Show Axes: true + Show Names: false + Tree: + base_link: + arm1: + arm2: + arm3: + {} + Update Interval: 0 + Value: true + Enabled: true + Global Options: + Background Color: 48; 48; 48 + Fixed Frame: base_link + Frame Rate: 30 + Name: root + Tools: + - Class: rviz_default_plugins/Interact + Hide Inactive Objects: true + - Class: rviz_default_plugins/MoveCamera + - Class: rviz_default_plugins/Select + - Class: rviz_default_plugins/FocusCamera + - Class: rviz_default_plugins/Measure + Line color: 128; 128; 0 + - Class: rviz_default_plugins/SetInitialPose + Covariance x: 0.25 + Covariance y: 0.25 + Covariance yaw: 0.06853891909122467 + Topic: + Depth: 5 + Durability Policy: Volatile + History Policy: Keep Last + Reliability Policy: Reliable + Value: /initialpose + - Class: rviz_default_plugins/SetGoal + Topic: + Depth: 5 + Durability Policy: Volatile + History Policy: Keep Last + Reliability Policy: Reliable + Value: /goal_pose + - Class: rviz_default_plugins/PublishPoint + Single click: true + Topic: + Depth: 5 + Durability Policy: Volatile + History Policy: Keep Last + Reliability Policy: Reliable + Value: /clicked_point + Transformation: + Current: + Class: rviz_default_plugins/TF + Value: true + Views: + Current: + Class: rviz_default_plugins/Orbit + Distance: 1.8436399698257446 + Enable Stereo Rendering: + Stereo Eye Separation: 0.05999999865889549 + Stereo Focal Distance: 1 + Swap Stereo Eyes: false + Value: false + Focal Point: + 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: 0.6997970938682556 + Target Frame: <Fixed Frame> + Value: Orbit (rviz) + Yaw: 1.5303975343704224 + Saved: ~ +Window Geometry: + Displays: + collapsed: false + Height: 846 + Hide Left Dock: false + Hide Right Dock: false + QMainWindow State: 000000ff00000000fd0000000400000000000001f70000024cfc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b000000b000fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000006e0000024c0000018200fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000015f0000024cfc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000006e0000024c0000013200fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000005810000005afc0100000002fb0000000800540069006d00650100000000000005810000058100fffffffb0000000800540069006d00650100000000000004500000000000000000000002130000024c00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 + Selection: + collapsed: false + Time: + collapsed: false + Tool Properties: + collapsed: false + Views: + collapsed: false + Width: 1409 + X: 965 + Y: 227 diff --git a/ros2_ws/src/simple_robot_1dof/setup.py b/ros2_ws/src/simple_robot_1dof/setup.py index 193051f60cac3dafba068325cb54e0423ccc79a5..dee6002c5e4a68aa17ccc99b18725e77ce6e450d 100644 --- a/ros2_ws/src/simple_robot_1dof/setup.py +++ b/ros2_ws/src/simple_robot_1dof/setup.py @@ -14,7 +14,9 @@ setup( ('share/' + package_name, ['package.xml']), ('share/' + package_name + '/launch', ['launch/kuka_rviz_simulation_1dof_launch.py']), ('share/' + package_name + '/rviz', ['rviz/forward_kinematics_simulations.rviz']), - (os.path.join('share', package_name, 'launch'), glob(os.path.join('launch', '*launch.[pxy][yma]*'))) + (os.path.join('share', package_name, 'urdf'), glob('urdf/*.urdf')), + (os.path.join('share', package_name, 'launch'), glob(os.path.join('launch', '*launch.[pxy][yma]*'))), + # (os.path.join('share', package_name), glob('urdf/*')), ], install_requires=['setuptools'], zip_safe=True, diff --git a/ros2_ws/src/simple_robot_1dof/simple_robot_1dof/forward_kinematics_node_1dof.py b/ros2_ws/src/simple_robot_1dof/simple_robot_1dof/forward_kinematics_node_1dof.py index b36b3e8a6bd10fc43d399e03947cedb59acff3c1..3ac27f8326a014810fe1747dfcd2084d3bc12766 100644 --- a/ros2_ws/src/simple_robot_1dof/simple_robot_1dof/forward_kinematics_node_1dof.py +++ b/ros2_ws/src/simple_robot_1dof/simple_robot_1dof/forward_kinematics_node_1dof.py @@ -84,6 +84,7 @@ class Forward_Kinematics_Node_1Dof(Node): start_forward_kinematics = FKinBody(self.M, self.Blist, self.joint_angles) start_position = start_forward_kinematics[:4 ,3] + self.get_logger().info('Start "%s"' %start_position) start_orientation = Rotation.from_matrix(start_forward_kinematics[:3, :3]).as_quat() end_forward_kinematics = np.matmul(intermediate_rotation, start_forward_kinematics) diff --git a/ros2_ws/src/simple_robot_1dof/urdf/simple_robot.urdf b/ros2_ws/src/simple_robot_1dof/urdf/simple_robot.urdf new file mode 100644 index 0000000000000000000000000000000000000000..3e53eaf6d99dcbc23ed63f8e5ae9867020fd0968 --- /dev/null +++ b/ros2_ws/src/simple_robot_1dof/urdf/simple_robot.urdf @@ -0,0 +1,81 @@ +<?xml version="1.0"?> +<robot name="simple_robot" xmlns:xacro="http://www.ros.org/wiki/xacro"> + + <link name="map"> + <origin rpy="0 0 0" xyz="0 0 0" /> + <visual> + <geometry> + <box size="0.1 0.1 0.1"/> + </geometry> + <material name="grey"> + <color rgba="0.5 0.5 0.5 1"/> + </material> + </visual> + </link> + + <link name="arm1"> + <visual> + <origin xyz="0 0 0.355" rpy="0 0 0"/> + <geometry> + <cylinder length="0.71" radius="0.02"/> + </geometry> + <material name="red"> + <color rgba="1.0 0.0 0.0 1"/> + </material> + </visual> + </link> + + <joint name="joint1" type="revolute"> + <parent link="map"/> + <child link="arm1"/> + <origin xyz="0 0 0.05"/> + <axis xyz="0 0 1"/> + <limit effort = "300" lower="-2.96705972839" upper="2.96705972839" velocity = "10" /> + </joint> + + <link name="arm2"> + <visual> + <origin xyz="-0.15 0 0" rpy="0 -1.5707 0"/> + <geometry> + <cylinder length="0.3" radius="0.02"/> + </geometry> + <material name="green"> + <color rgba="0.0 1.0 0.0 1"/> + </material> + </visual> + </link> + + <joint name="joint2" type="revolute"> + <parent link="arm1"/> + <child link="arm2"/> + <origin xyz="0 0 0.71"/> + <axis xyz="1 0 0"/> + <limit effort = "300" lower="-2.96705972839" upper="2.96705972839" velocity = "10" /> + </joint> + + <link name="arm3"> + <visual> + <origin xyz="-0.15 0 0" rpy="0 -1.5707 0"/> + <geometry> + <cylinder length="0.3" radius="0.02"/> + </geometry> + <material name="blue"> + <color rgba="0.0 0.0 1.0 1"/> + </material> + </visual> + </link> + + <joint name="joint3" type="revolute"> + <parent link="arm2"/> + <child link="arm3"/> + <origin xyz="-0.3 0 0"/> + <axis xyz="1 0 0"/> + <limit effort = "300" lower="-2.96705972839" upper="2.96705972839" velocity = "10" /> + </joint> + + +</robot> + + + +