Fix simulation running #191

Merged
solid-sinusoid merged 5 commits from fix-simulation-running into main 2024-05-27 14:36:08 +03:00
4 changed files with 50 additions and 52 deletions

View file

@ -15,7 +15,6 @@ import xacro
import os import os
from ament_index_python.packages import get_package_share_directory from ament_index_python.packages import get_package_share_directory
from rbs_arm import RbsBuilder
def launch_setup(context, *args, **kwargs): def launch_setup(context, *args, **kwargs):
# Initialize Arguments # Initialize Arguments
@ -53,7 +52,7 @@ def launch_setup(context, *args, **kwargs):
controllers_file = controllers_file.perform(context) controllers_file = controllers_file.perform(context)
# remappings = [("/tf", "tf"), ("/tf_static", "tf_static")] # remappings = [("/tf", "tf"), ("/tf_static", "tf_static")]
xacro_file = os.path.join(get_package_share_directory(description_package), "urdf", description_file) xacro_file = os.path.join(get_package_share_directory(description_package), "urdf", description_file)
robot_description_doc = xacro.process_file( robot_description_doc = xacro.process_file(
xacro_file, xacro_file,
@ -72,15 +71,10 @@ def launch_setup(context, *args, **kwargs):
} }
) )
# robot = RbsBuilder(6, "arm0", "world", "rbs_gripper")
# robot.base()
# robot.gripper()
# robot.ros2_control()
# robot.moveit()
robot_description_content = robot_description_doc.toprettyxml(indent=" ") robot_description_content = robot_description_doc.toprettyxml(indent=" ")
robot_description = {"robot_description": robot_description_content} robot_description = {"robot_description": robot_description_content}
robot_description_semantic_content = Command( robot_description_semantic_content = Command(
[ [
PathJoinSubstitution([FindExecutable(name="xacro")]), PathJoinSubstitution([FindExecutable(name="xacro")]),
@ -94,7 +88,7 @@ def launch_setup(context, *args, **kwargs):
"gripper_name:=", gripper_name, " ", "gripper_name:=", gripper_name, " ",
] ]
) )
robot_description_semantic = {"robot_description_semantic": robot_description_semantic_content} robot_description_semantic = {"robot_description_semantic": robot_description_semantic_content}
robot_description_kinematics = PathJoinSubstitution( robot_description_kinematics = PathJoinSubstitution(
[FindPackageShare(moveit_config_package), "config", "kinematics.yaml"] [FindPackageShare(moveit_config_package), "config", "kinematics.yaml"]
@ -145,7 +139,7 @@ def launch_setup(context, *args, **kwargs):
'namespace': namespace, 'namespace': namespace,
}.items(), }.items(),
condition=IfCondition(launch_controllers)) condition=IfCondition(launch_controllers))
moveit = IncludeLaunchDescription( moveit = IncludeLaunchDescription(
PythonLaunchDescriptionSource([ PythonLaunchDescriptionSource([
PathJoinSubstitution([ PathJoinSubstitution([
@ -183,7 +177,7 @@ def launch_setup(context, *args, **kwargs):
'namespace': namespace 'namespace': namespace
}.items() }.items()
) )
task_planner = IncludeLaunchDescription( task_planner = IncludeLaunchDescription(
PythonLaunchDescriptionSource([ PythonLaunchDescriptionSource([
PathJoinSubstitution([ PathJoinSubstitution([
@ -196,7 +190,7 @@ def launch_setup(context, *args, **kwargs):
# TBD # TBD
}.items(), }.items(),
condition=IfCondition(launch_task_planner)) condition=IfCondition(launch_task_planner))
perception = IncludeLaunchDescription( perception = IncludeLaunchDescription(
PythonLaunchDescriptionSource([ PythonLaunchDescriptionSource([
PathJoinSubstitution([ PathJoinSubstitution([
@ -310,101 +304,101 @@ def generate_launch_description():
) )
) )
declared_arguments.append( declared_arguments.append(
DeclareLaunchArgument("with_gripper", DeclareLaunchArgument("with_gripper",
default_value="true", default_value="true",
description="With gripper or not?") description="With gripper or not?")
) )
declared_arguments.append( declared_arguments.append(
DeclareLaunchArgument("launch_rviz", DeclareLaunchArgument("launch_rviz",
default_value="true", default_value="true",
description="Launch RViz?") description="Launch RViz?")
) )
declared_arguments.append( declared_arguments.append(
DeclareLaunchArgument("sim_gazebo", DeclareLaunchArgument("sim_gazebo",
default_value="true", default_value="true",
description="Gazebo Simulation") description="Gazebo Simulation")
) )
declared_arguments.append( declared_arguments.append(
DeclareLaunchArgument("env_manager", DeclareLaunchArgument("env_manager",
default_value="true", default_value="true",
description="Launch env_manager?") description="Launch env_manager?")
) )
declared_arguments.append( declared_arguments.append(
DeclareLaunchArgument("launch_sim", DeclareLaunchArgument("launch_sim",
default_value="true", default_value="true",
description="Launch simulator (Gazebo)?\ description="Launch simulator (Gazebo)?\
Most general arg") Most general arg")
) )
declared_arguments.append( declared_arguments.append(
DeclareLaunchArgument("launch_moveit", DeclareLaunchArgument("launch_moveit",
default_value="true", default_value="true",
description="Launch moveit?") description="Launch moveit?")
) )
declared_arguments.append( declared_arguments.append(
DeclareLaunchArgument("launch_perception", DeclareLaunchArgument("launch_perception",
default_value="false", default_value="false",
description="Launch perception?") description="Launch perception?")
) )
declared_arguments.append( declared_arguments.append(
DeclareLaunchArgument("launch_task_planner", DeclareLaunchArgument("launch_task_planner",
default_value="false", default_value="false",
description="Launch task_planner?") description="Launch task_planner?")
) )
declared_arguments.append( declared_arguments.append(
DeclareLaunchArgument("cartesian_controllers", DeclareLaunchArgument("cartesian_controllers",
default_value="false", default_value="false",
description="Load cartesian\ description="Load cartesian\
controllers?") controllers?")
) )
declared_arguments.append( declared_arguments.append(
DeclareLaunchArgument("hardware", DeclareLaunchArgument("hardware",
choices=["gazebo", "mock"], choices=["gazebo", "mock"],
default_value="gazebo", default_value="gazebo",
description="Choose your harware_interface") description="Choose your harware_interface")
) )
declared_arguments.append( declared_arguments.append(
DeclareLaunchArgument("launch_controllers", DeclareLaunchArgument("launch_controllers",
default_value="true", default_value="true",
description="Launch controllers?") description="Launch controllers?")
) )
declared_arguments.append( declared_arguments.append(
DeclareLaunchArgument("gazebo_gui", DeclareLaunchArgument("gazebo_gui",
default_value="false", default_value="false",
description="Launch gazebo with gui?") description="Launch gazebo with gui?")
) )
declared_arguments.append( declared_arguments.append(
DeclareLaunchArgument("namespace", DeclareLaunchArgument("namespace",
default_value="", default_value="",
description="The ROS2 namespace of a robot") description="The ROS2 namespace of a robot")
) )
declared_arguments.append( declared_arguments.append(
DeclareLaunchArgument("x", DeclareLaunchArgument("x",
default_value="0.0", default_value="0.0",
description="Position of robot in world by X") description="Position of robot in world by X")
) )
declared_arguments.append( declared_arguments.append(
DeclareLaunchArgument("y", DeclareLaunchArgument("y",
default_value="0.0", default_value="0.0",
description="Position of robot in world by Y") description="Position of robot in world by Y")
) )
declared_arguments.append( declared_arguments.append(
DeclareLaunchArgument("z", DeclareLaunchArgument("z",
default_value="0.0", default_value="0.0",
description="Position of robot in world by Z") description="Position of robot in world by Z")
) )
declared_arguments.append( declared_arguments.append(
DeclareLaunchArgument("roll", DeclareLaunchArgument("roll",
default_value="0.0", default_value="0.0",
description="Position of robot in world by Z") description="Position of robot in world by Z")
) )
declared_arguments.append( declared_arguments.append(
DeclareLaunchArgument("pitch", DeclareLaunchArgument("pitch",
default_value="0.0", default_value="0.0",
description="Position of robot in world by Z") description="Position of robot in world by Z")
) )
declared_arguments.append( declared_arguments.append(
DeclareLaunchArgument("yaw", DeclareLaunchArgument("yaw",
default_value="0.0", default_value="0.0",
description="Position of robot in world by Z") description="Position of robot in world by Z")
) )

View file

@ -53,7 +53,8 @@ def launch_setup(context, *args, **kwargs):
launch_arguments={ launch_arguments={
'sim_gazebo': sim_gazebo, 'sim_gazebo': sim_gazebo,
'debugger': "false", 'debugger': "false",
'launch_env_manager': "false" 'launch_env_manager': "false",
'gazebo_world_filename': "asm2.sdf"
}.items(), }.items(),
condition=IfCondition(launch_simulation) condition=IfCondition(launch_simulation)
) )

View file

@ -10,7 +10,6 @@
<buildtool_depend>ament_cmake</buildtool_depend> <buildtool_depend>ament_cmake</buildtool_depend>
<depend>rbs_utils</depend> <depend>rbs_utils</depend>
<depend>rbs_skill_interfaces</depend> <depend>rbs_skill_interfaces</depend>
<depend>component_interfaces</depend>
<depend>env_manager_interfaces</depend> <depend>env_manager_interfaces</depend>
<depend>behavior_tree</depend> <depend>behavior_tree</depend>
<test_depend>ament_lint_auto</test_depend> <test_depend>ament_lint_auto</test_depend>

View file

@ -15,3 +15,7 @@ repositories:
type: git type: git
url: https://github.com/osrf/dynamic_message_introspection.git url: https://github.com/osrf/dynamic_message_introspection.git
version: main version: main
robot_builder:
type: git
url: https://github.com/solid-sinusoid/robot-builder.git
version: main