diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 483fc04..307cb16 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -26,7 +26,7 @@ build-colcon-job: - mv * .src/robossembler-ros2 - mv .git .src/robossembler-ros2 - mv .src src - - vcs import src < src/robossembler-ros2/rbs.sim.repos + - vcs import src < src/robossembler-ros2/repos/sim.rbs.repos - rosdep install -y -r -q --from-paths src --ignore-src --rosdistro humble - colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release rules: diff --git a/README.md b/README.md index fd10f98..f3277de 100644 --- a/README.md +++ b/README.md @@ -26,20 +26,27 @@ Prepare workspace & install dependencies (So far only tested with UR robot arm) ```bash mkdir -p ~/robossembler_ws/src && cd ~/robossembler_ws/src git clone https://gitlab.com/robosphere/robossembler-ros2 -vcs import . < robossembler-ros2/rbs.sim.repos +vcs import . < robossembler-ros2/repos/sim.rbs.repos cd .. rosdep install -y -r -q --from-paths src --ignore-src --rosdistro humble colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --symlink-install ``` - + +Additionally, if you want to use Cartesian controllers, such as stiffness or others, you need to execute the following: +``` +# in directory robossembler_ws/src +vcs import . < robossembler-ros2/repos/cartesian_controllers.repos +``` +This will also install `ros2_control` and `gz_ros2_control` as packages, so it is recommended to delete global packages if they have been installed. ### Set Gazebo enviroment variables Replace `[WS_FOLDER]` with your workspace folder ```bash -echo "export IGN_GAZEBO_RESOURCE_PATH=${IGN_GAZEBO_RESOURCE_PATH}:~/[WS_FOLDER]/install/robotiq_description/share/:~/[WS_FOLDER]/install/rbs_simulation/share/rbs_simulation/" >> ~/.bashrc +echo "export IGN_GAZEBO_RESOURCE_PATH=${IGN_GAZEBO_RESOURCE_PATH}:~/[WS_FOLDER]/install/rbs_simulation/share/rbs_simulation/" >> ~/.bashrc +# or if you have alredy built the workspace +echo "export IGN_GAZEBO_RESOURCE_PATH=${IGN_GAZEBO_RESOURCE_PATH}:~/$(ros2 pkg prefix rbs_simulation)/share/rbs_simulation/" >> ~/.bashrc ``` - ### Examples Activate current ROS2 enviroment: ``` diff --git a/env_manager/gz_enviroment/src/gz_enviroment.cpp b/env_manager/gz_enviroment/src/gz_enviroment.cpp index 89432c7..0a8d3c6 100644 --- a/env_manager/gz_enviroment/src/gz_enviroment.cpp +++ b/env_manager/gz_enviroment/src/gz_enviroment.cpp @@ -41,7 +41,7 @@ CallbackReturn GzEnviroment::on_configure(const rclcpp_lifecycle::State &) { m_topic_name = std::string("/world/") + m_world_name + "/dynamic_pose/info"; m_service_spawn = std::string("/world/") + m_world_name + "/create"; m_config_loader = std::make_shared( - "asp-example2", getNode()); + "asp-example", getNode()); m_follow_frames = m_config_loader->getSceneModelNames(); // m_target_places = std::make_shared(); m_transforms = m_config_loader->getTfData("bishop"); @@ -92,8 +92,6 @@ CallbackReturn GzEnviroment::on_deactivate(const rclcpp_lifecycle::State &) { // TODO: Check to do this via EntityComponentManager void GzEnviroment::onGzPoseSub(const gz::msgs::Pose_V &pose_v) { - // TODO: Read from config - // m_follow_frames = {"box1", "box2", "box3", "box4", "box5", "box6"}; std::vector all_transforms{}; for (const auto &it : pose_v.pose()) { diff --git a/rbs_bringup/config/rbs.rviz b/rbs_bringup/config/rbs.rviz index df9e15c..3f2dc2f 100644 --- a/rbs_bringup/config/rbs.rviz +++ b/rbs_bringup/config/rbs.rviz @@ -6,9 +6,8 @@ Panels: Expanded: - /Global Options1 - /TF1/Frames1 - - /MarkerArray2 Splitter Ratio: 0.49496981501579285 - Tree Height: 981 + Tree Height: 985 - Class: rviz_common/Selection Name: Selection - Class: rviz_common/Tool Properties @@ -76,62 +75,37 @@ Visualization Manager: Expand Link Details: false Expand Tree: false Link Tree Style: Links in Alphabetic Order - base: - Alpha: 1 - Show Axes: false - Show Trail: false base_link: Alpha: 1 Show Axes: false Show Trail: false - base_link_inertia: + Value: true + ee_link: Alpha: 1 Show Axes: false Show Trail: false Value: true - flange: - Alpha: 1 - Show Axes: false - Show Trail: false - forearm_link: + fork0_link: Alpha: 1 Show Axes: false Show Trail: false Value: true - ft_frame: - Alpha: 1 - Show Axes: false - Show Trail: false - inner_rgbd_camera: + fork1_link: Alpha: 1 Show Axes: false Show Trail: false Value: true - outer_rgbd_camera: + fork2_link: Alpha: 1 Show Axes: false Show Trail: false Value: true - schunk_grasp_point: - Alpha: 1 - Show Axes: false - Show Trail: false - schunk_gripper_base_link: + main0_link: Alpha: 1 Show Axes: false Show Trail: false Value: true - schunk_l_finger_link: - Alpha: 1 - Show Axes: false - Show Trail: false - Value: true - schunk_r_finger_link: - Alpha: 1 - Show Axes: false - Show Trail: false - Value: true - shoulder_link: + main1_link: Alpha: 1 Show Axes: false Show Trail: false @@ -140,77 +114,37 @@ Visualization Manager: Alpha: 1 Show Axes: false Show Trail: false - upper_arm_link: - Alpha: 1 - Show Axes: false - Show Trail: false - Value: true world: Alpha: 1 Show Axes: false Show Trail: false - wrist_1_link: - Alpha: 1 - Show Axes: false - Show Trail: false - Value: true - wrist_2_link: - Alpha: 1 - Show Axes: false - Show Trail: false - Value: true - wrist_3_link: - Alpha: 1 - Show Axes: false - Show Trail: false - Value: true Robot Alpha: 1 Show Robot Collision: false - Show Robot Visual: true + Show Robot Visual: false Value: true - Class: rviz_default_plugins/TF Enabled: true Frame Timeout: 15 Frames: All Enabled: false - base: - Value: false base_link: Value: false - base_link_inertia: - Value: false - flange: - Value: false - forearm_link: - Value: false - ft_frame: - Value: false - inner_rgbd_camera: - Value: false - outer_rgbd_camera: - Value: false - schunk_grasp_point: + ee_link: Value: true - schunk_gripper_base_link: + fork0_link: Value: true - schunk_l_finger_link: + fork1_link: Value: true - schunk_r_finger_link: + fork2_link: + Value: true + main0_link: + Value: true + main1_link: Value: true - shoulder_link: - Value: false tool0: Value: false - upper_arm_link: - Value: false world: Value: false - wrist_1_link: - Value: false - wrist_2_link: - Value: false - wrist_3_link: - Value: false Marker Scale: 0.4000000059604645 Name: TF Show Arrows: true @@ -219,30 +153,14 @@ Visualization Manager: Tree: world: base_link: - base: - {} - base_link_inertia: - shoulder_link: - upper_arm_link: - forearm_link: - wrist_1_link: - wrist_2_link: - wrist_3_link: - flange: - tool0: - inner_rgbd_camera: - {} - schunk_grasp_point: - {} - schunk_gripper_base_link: - schunk_l_finger_link: - {} - schunk_r_finger_link: - {} - ft_frame: - {} - outer_rgbd_camera: - {} + fork0_link: + main0_link: + fork1_link: + main1_link: + fork2_link: + ee_link: + tool0: + {} Update Interval: 0 Value: true - Class: moveit_rviz_plugin/Trajectory @@ -255,62 +173,37 @@ Visualization Manager: Expand Link Details: false Expand Tree: false Link Tree Style: Links in Alphabetic Order - base: - Alpha: 1 - Show Axes: false - Show Trail: false base_link: Alpha: 1 Show Axes: false Show Trail: false - base_link_inertia: + Value: true + ee_link: Alpha: 1 Show Axes: false Show Trail: false Value: true - flange: - Alpha: 1 - Show Axes: false - Show Trail: false - forearm_link: + fork0_link: Alpha: 1 Show Axes: false Show Trail: false Value: true - ft_frame: - Alpha: 1 - Show Axes: false - Show Trail: false - inner_rgbd_camera: + fork1_link: Alpha: 1 Show Axes: false Show Trail: false Value: true - outer_rgbd_camera: + fork2_link: Alpha: 1 Show Axes: false Show Trail: false Value: true - schunk_grasp_point: - Alpha: 1 - Show Axes: false - Show Trail: false - schunk_gripper_base_link: + main0_link: Alpha: 1 Show Axes: false Show Trail: false Value: true - schunk_l_finger_link: - Alpha: 1 - Show Axes: false - Show Trail: false - Value: true - schunk_r_finger_link: - Alpha: 1 - Show Axes: false - Show Trail: false - Value: true - shoulder_link: + main1_link: Alpha: 1 Show Axes: false Show Trail: false @@ -319,30 +212,10 @@ Visualization Manager: Alpha: 1 Show Axes: false Show Trail: false - upper_arm_link: - Alpha: 1 - Show Axes: false - Show Trail: false - Value: true world: Alpha: 1 Show Axes: false Show Trail: false - wrist_1_link: - Alpha: 1 - Show Axes: false - Show Trail: false - Value: true - wrist_2_link: - Alpha: 1 - Show Axes: false - Show Trail: false - Value: true - wrist_3_link: - Alpha: 1 - Show Axes: false - Show Trail: false - Value: true Loop Animation: false Name: Trajectory Robot Alpha: 0.5 @@ -368,6 +241,84 @@ Visualization Manager: Reliability Policy: Reliable Value: workspace Value: true + - Class: rviz_default_plugins/InteractiveMarkers + Enable Transparency: true + Enabled: true + Interactive Markers Namespace: /motion_controller_handle + Name: InteractiveMarkers + Show Axes: false + Show Descriptions: true + Show Visual Aids: false + 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 + base_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + ee_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + fork0_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + fork1_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + fork2_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + main0_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + main1_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + tool0: + Alpha: 1 + Show Axes: false + Show Trail: false + world: + Alpha: 1 + Show Axes: false + Show Trail: false + Mass Properties: + Inertia: false + Mass: false + Name: RobotModel + TF Prefix: "" + Update Interval: 0 + Value: true + Visual Enabled: true Enabled: true Global Options: Background Color: 48; 48; 48 @@ -414,7 +365,7 @@ Visualization Manager: Views: Current: Class: rviz_default_plugins/Orbit - Distance: 6.619869709014893 + Distance: 2.528358221054077 Enable Stereo Rendering: Stereo Eye Separation: 0.05999999865889549 Stereo Focal Distance: 1 @@ -429,10 +380,10 @@ Visualization Manager: Invert Z Axis: false Name: Current View Near Clip Distance: 0.009999999776482582 - Pitch: 0.5753980875015259 + Pitch: 0.5803980827331543 Target Frame: Value: Orbit (rviz) - Yaw: 1.1453965902328491 + Yaw: 1.0903966426849365 Saved: ~ Window Geometry: Displays: @@ -440,7 +391,7 @@ Window Geometry: Height: 1385 Hide Left Dock: false Hide Right Dock: false - QMainWindow State: 000000ff00000000fd00000004000000000000025f000004cdfc020000000cfb0000001200530065006c0065006300740069006f006e00000001e10000009b000000b000fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000006e000004cd0000018200fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb00000044004d006f00740069006f006e0050006c0061006e006e0069006e00670020002d0020005400720061006a006500630074006f0072007900200053006c00690064006500720000000000ffffffff0000000000000000fb0000001c004d006f00740069006f006e0050006c0061006e006e0069006e0067010000032c000002170000000000000000fb000000280020002d0020005400720061006a006500630074006f0072007900200053006c00690064006500720000000000ffffffff0000000000000000fb0000003c005400720061006a006500630074006f007200790020002d0020005400720061006a006500630074006f0072007900200053006c00690064006500720000000000ffffffff0000007a00ffffff000000010000015f000004cdfc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000006e000004cd0000013200fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d006501000000000000045000000000000000000000052d000004cd00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 + QMainWindow State: 000000ff00000000fd00000004000000000000025f000004cffc020000000cfb0000001200530065006c0065006300740069006f006e00000001e10000009b000000af00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000006d000004cf0000018000fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb00000044004d006f00740069006f006e0050006c0061006e006e0069006e00670020002d0020005400720061006a006500630074006f0072007900200053006c00690064006500720000000000ffffffff0000000000000000fb0000001c004d006f00740069006f006e0050006c0061006e006e0069006e0067010000032c000002170000000000000000fb000000280020002d0020005400720061006a006500630074006f0072007900200053006c00690064006500720000000000ffffffff0000000000000000fb0000003c005400720061006a006500630074006f007200790020002d0020005400720061006a006500630074006f0072007900200053006c00690064006500720000000000ffffffff0000007800ffffff0000000100000166000004cffc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000006d000004cf0000012f00fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d0065010000000000000450000000000000000000000698000004cf00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 Selection: collapsed: false Tool Properties: @@ -450,5 +401,5 @@ Window Geometry: Views: collapsed: false Width: 2307 - X: 436 - Y: 66 + X: 507 + Y: 315 diff --git a/rbs_bringup/launch/bringup.launch.py b/rbs_bringup/launch/bringup.launch.py index 3b6ef07..7e5fe2b 100644 --- a/rbs_bringup/launch/bringup.launch.py +++ b/rbs_bringup/launch/bringup.launch.py @@ -1,5 +1,4 @@ -import os -from launch import LaunchDescription +from launch import LaunchDescription, condition from launch.actions import ( DeclareLaunchArgument, IncludeLaunchDescription, @@ -9,7 +8,6 @@ from launch.launch_description_sources import PythonLaunchDescriptionSource from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution from launch_ros.actions import Node from launch_ros.substitutions import FindPackageShare -# from rbs_launch_utils.launch_common import load_yaml_abs def generate_launch_description(): declared_arguments = [] @@ -17,50 +15,22 @@ def generate_launch_description(): DeclareLaunchArgument( "rbs_robot_type", description="Type of robot by name", - choices=["ur3", "ur3e", "ur5", "ur5e", "ur10", "ur10e", "ur16e"], - default_value="ur5e", - ) - ) - declared_arguments.append( - DeclareLaunchArgument( - "safety_limits", - default_value="true", - description="Enables the safety limits controller if true.", - ) - ) - declared_arguments.append( - DeclareLaunchArgument( - "safety_pos_margin", - default_value="0.15", - description="The margin to lower and upper limits in the safety controller.", - ) - ) - declared_arguments.append( - DeclareLaunchArgument( - "safety_k_position", - default_value="20", - description="k-position factor in the safety controller.", + choices=["rbs_arm","ur3", "ur3e", "ur5", "ur5e", "ur10", "ur10e", "ur16e"], + default_value="rbs_arm", ) ) # General arguments declared_arguments.append( DeclareLaunchArgument( "controllers_file", - default_value="ur_plus_gripper_controllers.yaml", + default_value="rbs_arm_controllers_gazebosim.yaml", description="YAML file with the controllers configuration.", ) ) - declared_arguments.append( - DeclareLaunchArgument( - "controllers_with_gripper_file", - default_value="ur_plus_gripper_controllers.yaml", - description="YAML file with the UR + gripper_controller configuration.", - ) - ) declared_arguments.append( DeclareLaunchArgument( "description_package", - default_value="ur_description", + default_value="rbs_arm", description="Description package with robot URDF/XACRO files. Usually the argument \ is not set, it enables use of a custom description.", ) @@ -68,7 +38,7 @@ def generate_launch_description(): declared_arguments.append( DeclareLaunchArgument( "description_file", - default_value="ur.urdf.xacro", + default_value="rbs_arm_modular.xacro", description="URDF/XACRO description file with the robot.", ) ) @@ -95,19 +65,10 @@ def generate_launch_description(): description="Robot controller to start.", ) ) - - declared_arguments.append( - DeclareLaunchArgument( - "initial_gripper_controller", - default_value="gripper_controller", - description="Robot controller to start.", - ) - ) - declared_arguments.append( DeclareLaunchArgument( "moveit_config_package", - default_value="ur_moveit_config", + default_value="rbs_arm", description="MoveIt config package with robot SRDF/XACRO files. Usually the argument \ is not set, it enables use of a custom moveit config.", ) @@ -115,7 +76,7 @@ def generate_launch_description(): declared_arguments.append( DeclareLaunchArgument( "moveit_config_file", - default_value="ur.srdf.xacro", + default_value="rbs_arm.srdf.xacro", description="MoveIt SRDF/XACRO description file with the robot.", ) ) @@ -123,48 +84,75 @@ def generate_launch_description(): DeclareLaunchArgument( "use_sim_time", default_value="true", - description="Make MoveIt to use simulation time. This is needed for the trajectory planing in simulation.", + description="Make MoveIt to use simulation time.\ + This is needed for the trajectory planing in simulation.", ) ) declared_arguments.append( - DeclareLaunchArgument("with_gripper", default_value="true", description="With gripper or not?") + DeclareLaunchArgument("with_gripper", + default_value="true", + description="With gripper or not?") ) declared_arguments.append( - DeclareLaunchArgument("launch_rviz", default_value="true", description="Launch RViz?") + DeclareLaunchArgument("launch_rviz", + default_value="true", + description="Launch RViz?") ) declared_arguments.append( - DeclareLaunchArgument("sim_gazebo", default_value="true", description="Gazebo Simulation") + DeclareLaunchArgument("sim_gazebo", + default_value="true", + description="Gazebo Simulation") ) declared_arguments.append( - DeclareLaunchArgument("sim_mujoco", default_value="false", description="Mujoco Simulation") + DeclareLaunchArgument("env_manager", + default_value="true", + description="Launch env_manager?") ) declared_arguments.append( - DeclareLaunchArgument("sim_fake", default_value="false", description="Mock contollers") + DeclareLaunchArgument("launch_sim", + default_value="true", + description="Launch simulator (Gazebo)?\ + Most general arg") ) declared_arguments.append( - DeclareLaunchArgument("env_manager", default_value="true", description="Launch env_manager?") + DeclareLaunchArgument("launch_moveit", + default_value="true", + description="Launch moveit?") ) declared_arguments.append( - DeclareLaunchArgument("launch_sim", default_value="true", description="Launch simulator (Gazebo)? Most general arg") + DeclareLaunchArgument("launch_perception", + default_value="false", + description="Launch perception?") ) declared_arguments.append( - DeclareLaunchArgument("launch_moveit", default_value="true", description="Launch moveit?") + DeclareLaunchArgument("launch_task_planner", + default_value="false", + description="Launch task_planner?") ) declared_arguments.append( - DeclareLaunchArgument("launch_perception", default_value="false", description="Launch perception?") + DeclareLaunchArgument("cartesian_controllers", + default_value="false", + description="Load cartesian\ + controllers?") ) declared_arguments.append( - DeclareLaunchArgument("launch_task_planner", default_value="false", description="Launch task_planner?") + DeclareLaunchArgument("hardware", + choices=["gazebo", "mock"], + default_value="gazebo", + description="Choose your harware_interface") ) declared_arguments.append( - DeclareLaunchArgument("cartesian_controllers", default_value="false", description="Load cartesian controllers?") + DeclareLaunchArgument("launch_controllers", + default_value="true", + description="Launch controllers?") + ) + declared_arguments.append( + DeclareLaunchArgument("gazebo_gui", + default_value="false", + description="Launch gazebo with gui?") ) - # Initialize Arguments rbs_robot_type = LaunchConfiguration("rbs_robot_type") - safety_limits = LaunchConfiguration("safety_limits") - safety_pos_margin = LaunchConfiguration("safety_pos_margin") - safety_k_position = LaunchConfiguration("safety_k_position") # General arguments with_gripper_condition = LaunchConfiguration("with_gripper") controllers_file = LaunchConfiguration("controllers_file") @@ -183,10 +171,10 @@ def generate_launch_description(): moveit_config_file = LaunchConfiguration("moveit_config_file") use_sim_time = LaunchConfiguration("use_sim_time") sim_gazebo = LaunchConfiguration("sim_gazebo") - sim_mujoco = LaunchConfiguration("sim_mujoco") - sim_fake = LaunchConfiguration("sim_fake") + hardware = LaunchConfiguration("hardware") env_manager = LaunchConfiguration("env_manager") - + launch_controllers = LaunchConfiguration("launch_controllers") + gazebo_gui = LaunchConfiguration("gazebo_gui") initial_joint_controllers_file_path = PathJoinSubstitution( [FindPackageShare(description_package), "config", controllers_file] @@ -195,44 +183,36 @@ def generate_launch_description(): rviz_config_file = PathJoinSubstitution( [FindPackageShare("rbs_bringup"), "config", "rbs.rviz"] ) - robot_description_content = Command( [ PathJoinSubstitution([FindExecutable(name="xacro")]), " ", - PathJoinSubstitution( - [FindPackageShare(description_package), "urdf", description_file] - ), + PathJoinSubstitution([FindPackageShare(description_package), "urdf", description_file]), " ", - "safety_limits:=", safety_limits, " ", - "safety_pos_margin:=", safety_pos_margin, " ", - "safety_k_position:=", safety_k_position, " ", - "name:=", "ur", " ", - "ur_type:=", rbs_robot_type, " ", + "gripper_name:=", "", " ", "prefix:=", prefix, " ", - "sim_mujoco:=", sim_mujoco, " ", - "sim_gazebo:=", sim_gazebo, " ", - "sim_fake:=", sim_fake, " ", + "hardware:=", hardware, " ", "simulation_controllers:=", initial_joint_controllers_file_path, " ", - "with_gripper:=", with_gripper_condition, " ", + ] ) + robot_description = {"robot_description": robot_description_content} - # MoveIt Configuration robot_description_semantic_content = Command( [ PathJoinSubstitution([FindExecutable(name="xacro")]), " ", PathJoinSubstitution( - [FindPackageShare(moveit_config_package), "srdf", moveit_config_file] - ), " ", - "name:=", "ur", " ", - "prefix:=", prefix, " ", - "with_gripper:=", with_gripper_condition + [FindPackageShare(moveit_config_package), "config/moveit", "rbs_arm.srdf.xacro"] + ), + " ", + "name:=","rbs_arm"," ", + "prefix:=",prefix," ", ] ) + robot_description_semantic = {"robot_description_semantic": robot_description_semantic_content} robot_description_kinematics = PathJoinSubstitution( [FindPackageShare(moveit_config_package), "config", "kinematics.yaml"] @@ -260,7 +240,7 @@ def generate_launch_description(): control = IncludeLaunchDescription( PythonLaunchDescriptionSource([ PathJoinSubstitution([ - FindPackageShare('ur_description'), + FindPackageShare('rbs_arm'), 'launch', 'control.launch.py' ]) @@ -272,7 +252,8 @@ def generate_launch_description(): 'initial_joint_controller': initial_joint_controller, 'controllers_file': controllers_file, "cartesian_controllers": cartesian_controllers - }.items()) + }.items(), + condition=IfCondition(launch_controllers)) simulation = IncludeLaunchDescription( PythonLaunchDescriptionSource([ @@ -284,15 +265,17 @@ def generate_launch_description(): ]), launch_arguments={ 'sim_gazebo': sim_gazebo, + 'gazebo_gui': gazebo_gui, 'rbs_robot_type': rbs_robot_type, - 'env_manager': env_manager + 'env_manager': env_manager, + 'debugger': "false" }.items(), condition=IfCondition(launch_simulation)) moveit = IncludeLaunchDescription( PythonLaunchDescriptionSource([ PathJoinSubstitution([ - FindPackageShare('ur_moveit_config'), + FindPackageShare('rbs_arm'), 'launch', 'moveit.launch.py' ]) @@ -322,7 +305,6 @@ def generate_launch_description(): 'robot_description_kinematics': robot_description_kinematics, 'use_sim_time': use_sim_time, 'with_gripper_condition': with_gripper_condition, - 'points_params_filepath': "gripperPositions.yaml" }.items() ) @@ -363,7 +345,3 @@ def generate_launch_description(): perception ] return LaunchDescription(declared_arguments + nodes_to_start) - - - - diff --git a/rbs_bt_executor/bt_trees/example_skills/env_manager_starter.xml b/rbs_bt_executor/bt_trees/example_skills/env_manager_starter.xml new file mode 100644 index 0000000..41fd05c --- /dev/null +++ b/rbs_bt_executor/bt_trees/example_skills/env_manager_starter.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + diff --git a/rbs_bt_executor/bt_trees/example_skills/move_to_joint_states.xml b/rbs_bt_executor/bt_trees/example_skills/move_to_joint_states.xml new file mode 100644 index 0000000..b07ff12 --- /dev/null +++ b/rbs_bt_executor/bt_trees/example_skills/move_to_joint_states.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + diff --git a/rbs_bt_executor/bt_trees/example_skills/move_to_pose.xml b/rbs_bt_executor/bt_trees/example_skills/move_to_pose.xml new file mode 100644 index 0000000..54db9b6 --- /dev/null +++ b/rbs_bt_executor/bt_trees/example_skills/move_to_pose.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + diff --git a/rbs_bt_executor/bt_trees/example_skills/move_to_pose_array.xml b/rbs_bt_executor/bt_trees/example_skills/move_to_pose_array.xml new file mode 100644 index 0000000..c9e3414 --- /dev/null +++ b/rbs_bt_executor/bt_trees/example_skills/move_to_pose_array.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/rbs_bt_executor/bt_trees/nodes_interfaces/general.xml b/rbs_bt_executor/bt_trees/nodes_interfaces/general.xml new file mode 100644 index 0000000..50d7f6d --- /dev/null +++ b/rbs_bt_executor/bt_trees/nodes_interfaces/general.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/rbs_bt_executor/bt_trees/test_tree.xml b/rbs_bt_executor/bt_trees/test_tree.xml index 8e11ecc..6e59ee7 100644 --- a/rbs_bt_executor/bt_trees/test_tree.xml +++ b/rbs_bt_executor/bt_trees/test_tree.xml @@ -6,7 +6,7 @@ + robot_name="rbs_arm" /> @@ -24,33 +24,13 @@ + + - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/rbs_bt_executor/src/MoveToPoseArray.cpp b/rbs_bt_executor/src/MoveToPoseArray.cpp index ed7a1ce..4d2ce81 100644 --- a/rbs_bt_executor/src/MoveToPoseArray.cpp +++ b/rbs_bt_executor/src/MoveToPoseArray.cpp @@ -30,7 +30,8 @@ public: goal.target_pose = target_pose_vec_.poses.at(0); target_pose_vec_.poses.erase(target_pose_vec_.poses.begin()); - setOutput("pose_vec_out", target_pose_vec_); + setOutput("pose_vec_out", + target_pose_vec_); } else { RCLCPP_WARN(_node->get_logger(), "Target pose vector empty"); } @@ -39,11 +40,10 @@ public: } static BT::PortsList providedPorts() { - return providedBasicPorts({ - BT::InputPort("robot_name"), - BT::InputPort("pose_vec_in"), - BT::OutputPort("pose_vec_out") - }); + return providedBasicPorts( + {BT::InputPort("robot_name"), + BT::InputPort("pose_vec_in"), + BT::OutputPort("pose_vec_out")}); } private: diff --git a/rbs_simulation/launch/simulation.launch.py b/rbs_simulation/launch/simulation.launch.py index 88715a9..03efd4e 100644 --- a/rbs_simulation/launch/simulation.launch.py +++ b/rbs_simulation/launch/simulation.launch.py @@ -12,27 +12,38 @@ from ament_index_python.packages import get_package_share_directory def generate_launch_description(): declared_arguments = [] declared_arguments.append( - DeclareLaunchArgument("sim_gazebo", default_value="false", description="Gazebo Simulation") + DeclareLaunchArgument("sim_gazebo", + default_value="false", + description="Gazebo Simulation") ) declared_arguments.append( - DeclareLaunchArgument( - "rbs_robot_type", - description="Type of robot by name", - choices=["ur3", "ur3e", "ur5", "ur5e", "ur10", "ur10e", "ur16e"], - default_value="ur5e", - ) + DeclareLaunchArgument("rbs_robot_type", + description="Type of robot by name", + choices=["rbs_arm" ,"ur3", "ur3e", "ur5", "ur5e", "ur10", "ur10e", "ur16e"], + default_value="rbs_arm",) ) declared_arguments.append( - DeclareLaunchArgument("env_manager", default_value="false", description="Launch env_manager?") + DeclareLaunchArgument("env_manager", + default_value="false", + description="Launch env_manager?") ) declared_arguments.append( - DeclareLaunchArgument("gazebo_gui", default_value="false", description="Launch env_manager?") + DeclareLaunchArgument("gazebo_gui", + default_value="true", + description="Launch env_manager?") + ) + declared_arguments.append( + DeclareLaunchArgument("debugger", + default_value="false", + description="launch Gazebo with debugger?") ) sim_gazebo = LaunchConfiguration("sim_gazebo") rbs_robot_type = LaunchConfiguration("rbs_robot_type") env_manager_cond = LaunchConfiguration("env_manager") gazebo_gui = LaunchConfiguration("gazebo_gui") + debugger = LaunchConfiguration("debugger") + # FIXME: To args when we'll have different files # TODO: Use global variable to find world file in robossembler_db world_config_file = PathJoinSubstitution( @@ -44,31 +55,38 @@ def generate_launch_description(): PythonLaunchDescriptionSource( [os.path.join(get_package_share_directory('ros_gz_sim'), 'launch', 'gz_sim.launch.py')]), - launch_arguments=[('ign_args', [' -r ',world_config_file, " -s"])], + launch_arguments={ + 'gz_args': [' -r ',world_config_file, " -s"], + "debugger": debugger, + }.items(), condition=UnlessCondition(gazebo_gui)) gazebo = IncludeLaunchDescription( PythonLaunchDescriptionSource( [os.path.join(get_package_share_directory('ros_gz_sim'), 'launch', 'gz_sim.launch.py')]), - launch_arguments=[('ign_args', [' -r ',world_config_file])], + launch_arguments={ + 'gz_args': [' -r ',world_config_file], + "debugger": debugger, + }.items(), condition=IfCondition(gazebo_gui)) # Spawn robot - gazebo_spawn_robot = Node(package='ros_ign_gazebo', executable='create', - arguments=[ - '-name', rbs_robot_type, - '-x', '0.0', - '-z', '0.0', - '-y', '0.0', - '-topic', '/robot_description'], - output='screen', - condition=IfCondition(sim_gazebo)) + gazebo_spawn_robot = Node( + package='ros_gz_sim', + executable='create', + arguments=[ + '-name', rbs_robot_type, + '-x', '0.0', + '-z', '0.0', + '-y', '0.0', + '-topic', '/robot_description'], + output='screen', + condition=IfCondition(sim_gazebo)) env_manager = Node(package="env_manager", executable="run_env_manager", - condition=IfCondition(env_manager_cond) - ) - + condition=IfCondition(env_manager_cond)) + # Bridge rgbd_bridge_out = Node( package='ros_gz_bridge', @@ -80,8 +98,7 @@ def generate_launch_description(): '/outer_rgbd_camera/points@sensor_msgs/msg/PointCloud2@gz.msgs.PointCloudPacked' ], output='screen', - condition=IfCondition(sim_gazebo) - ) + condition=IfCondition(sim_gazebo)) rgbd_bridge_in = Node( package='ros_gz_bridge', @@ -93,9 +110,14 @@ def generate_launch_description(): '/inner_rgbd_camera/points@sensor_msgs/msg/PointCloud2@gz.msgs.PointCloudPacked' ], output='screen', - ) - + condition=IfCondition(sim_gazebo)) + clock_bridge = Node( + package='ros_gz_bridge', + executable='parameter_bridge', + arguments=['/clock@rosgraph_msgs/msg/Clock[ignition.msgs.Clock'], + output='screen', + condition=IfCondition(sim_gazebo)) nodes_to_start = [ gazebo, @@ -103,6 +125,7 @@ def generate_launch_description(): gazebo_spawn_robot, env_manager, rgbd_bridge_out, - rgbd_bridge_in + rgbd_bridge_in, + clock_bridge, ] return LaunchDescription(declared_arguments + nodes_to_start) diff --git a/rbs_simulation/mujoco_model/current_mj.xml b/rbs_simulation/mujoco_model/current_mj.xml index 465d8f3..d978eae 100644 --- a/rbs_simulation/mujoco_model/current_mj.xml +++ b/rbs_simulation/mujoco_model/current_mj.xml @@ -2,6 +2,9 @@ + + + @@ -11,6 +14,8 @@ + + diff --git a/rbs_simulation/worlds/mir.sdf b/rbs_simulation/worlds/mir.sdf index 18f5fb5..112b8f1 100644 --- a/rbs_simulation/worlds/mir.sdf +++ b/rbs_simulation/worlds/mir.sdf @@ -12,7 +12,8 @@ ogre2 - + + 0 0 -9.8 6e-06 2.3e-05 -4.2e-05 diff --git a/rbs_utils/src/rbs_utils.cpp b/rbs_utils/src/rbs_utils.cpp index 45db08f..ba92706 100644 --- a/rbs_utils/src/rbs_utils.cpp +++ b/rbs_utils/src/rbs_utils.cpp @@ -349,10 +349,10 @@ AssemblyConfigLoader::getWorkspaceInspectorTrajectory() { if (json.contains("workspace")) { auto workspace = readWorkspaceJson(json); for (auto &point : workspace.transforms) { - geometry_msgs::msg::Pose pose; - pose = transformTrajectory(point); + auto pose = transformTrajectory(point); pose_array.poses.push_back(pose); } + pose_array.poses.push_back(transformTrajectory(workspace.transforms[0])); } } return pose_array; @@ -361,9 +361,9 @@ AssemblyConfigLoader::getWorkspaceInspectorTrajectory() { geometry_msgs::msg::Pose AssemblyConfigLoader::transformTrajectory( const geometry_msgs::msg::TransformStamped &pose) { auto pose_eigen = tf2::transformToEigen(pose.transform); - Eigen::AngleAxisd rotation(M_PI, Eigen::Vector3d::UnitX()); + Eigen::AngleAxisd rotation(M_PI, Eigen::Vector3d::UnitY()); pose_eigen.rotate(rotation); - pose_eigen.translation().z() += 0.5; + pose_eigen.translation().z() += 0.35; auto pose_msg = tf2::toMsg(pose_eigen); return pose_msg; } diff --git a/repos/cartesian_controllers.repos b/repos/cartesian_controllers.repos new file mode 100644 index 0000000..a7429cc --- /dev/null +++ b/repos/cartesian_controllers.repos @@ -0,0 +1,13 @@ +repositories: + cartesian-controllers: + type: git + url: https://github.com/fzi-forschungszentrum-informatik/cartesian_controllers.git + version: ros2 + ros2_control: + type: git + url: https://github.com/solid-sinusoid/gz_ros2_control.git + version: gz-ros2-cartesian-controllers + gz_ros2_control: + type: git + url: https://github.com/solid-sinusoid/gz_ros2_control.git + version: pass-robot-description diff --git a/rbs.real.repos b/repos/real.repos similarity index 81% rename from rbs.real.repos rename to repos/real.repos index 8cc8183..7968965 100644 --- a/rbs.real.repos +++ b/repos/real.repos @@ -15,7 +15,3 @@ repositories: type: git url: https://gitlab.com/robossembler/arm-tools/urdf-model-shrunk-gripper-egp-40-n-n-b.git version: 2-add-ros2-control - gz_ros2_control: - type: git - url: https://github.com/solid-sinusoid/gz_ros2_control.git - version: ft-sensor-broadcaster \ No newline at end of file diff --git a/repos/sim.rbs.repos b/repos/sim.rbs.repos new file mode 100644 index 0000000..a875501 --- /dev/null +++ b/repos/sim.rbs.repos @@ -0,0 +1,13 @@ +repositories: + rbs_arm: + type: git + url: https://github.com/solid-sinusoid/rbs-arm.git + version: main + rbs_gripper: + type: git + url: https://github.com/solid-sinusoid/rbs-gripper.git + version: main + behavior_tree: + type: git + url: https://github.com/solid-sinusoid/behavior_tree.git + version: master diff --git a/rbs.sim.repos b/repos/sim.ur.repos similarity index 80% rename from rbs.sim.repos rename to repos/sim.ur.repos index 17cbd05..e939e90 100644 --- a/rbs.sim.repos +++ b/repos/sim.ur.repos @@ -15,7 +15,3 @@ repositories: type: git url: https://gitlab.com/robossembler/arm-tools/urdf-model-shrunk-gripper-egp-40-n-n-b.git version: 2-add-ros2-control - gz_ros2_control: - type: git - url: https://github.com/solid-sinusoid/gz_ros2_control.git - version: ft-sensor-broadcaster