🔨 get stable launch move_group plus gazebo
This commit is contained in:
parent
e965d90ab8
commit
77739576fc
7 changed files with 197 additions and 201 deletions
|
@ -11,16 +11,32 @@ import xacro
|
|||
import os
|
||||
from ament_index_python import get_package_share_directory
|
||||
|
||||
def generate_launch_description():
|
||||
|
||||
def launch_setup(context, *args, **kwargs):
|
||||
# Launch arguments
|
||||
launch_args = []
|
||||
|
||||
# Evaluate frequently used variables
|
||||
model = LaunchConfiguration("model").perform(context)
|
||||
launch_args.append(DeclareLaunchArgument(
|
||||
name="robot_name",
|
||||
default_value="rasms",
|
||||
description="Set robot name."
|
||||
)
|
||||
)
|
||||
|
||||
launch_args.append(DeclareLaunchArgument(
|
||||
name="sim",
|
||||
default_value="true",
|
||||
description="Launch robot in simulation or on real setup."
|
||||
)
|
||||
)
|
||||
# get xacro file path
|
||||
xacro_file = os.path.join(get_package_share_directory("rasms_description"),"urdf/","rasms_description.urdf.xacro")
|
||||
# get error if xacro file if missing
|
||||
assert os.path.exists(xacro_file), "The xacro file of rasms_description doesnt exist"+str(xacro_file)
|
||||
# parse xacro file from file
|
||||
robot_description = xacro.process_file(xacro_file)
|
||||
# convert file to xml format
|
||||
robot_description_content = robot_description.toxml()
|
||||
#print(robot_description_content)
|
||||
|
||||
# Load controls
|
||||
control = IncludeLaunchDescription(
|
||||
|
@ -31,10 +47,7 @@ def launch_setup(context, *args, **kwargs):
|
|||
"rasms_control.launch.py"
|
||||
])
|
||||
), launch_arguments=[
|
||||
("robot_description", robot_description_content),
|
||||
("controller_configurations_package", LaunchConfiguration("controller_configurations_package")),
|
||||
("controller_configurations", LaunchConfiguration("controller_configurations")),
|
||||
("sim", LaunchConfiguration("sim"))
|
||||
("robot_description", robot_description_content)
|
||||
]
|
||||
)
|
||||
|
||||
|
@ -64,76 +77,18 @@ def launch_setup(context, *args, **kwargs):
|
|||
),
|
||||
launch_arguments=[
|
||||
("robot_description", robot_description_content),
|
||||
("moveit_controller_configurations_package", LaunchConfiguration("moveit_controller_configurations_package")),
|
||||
("moveit_controller_configurations", LaunchConfiguration("moveit_controller_configurations")),
|
||||
("model", LaunchConfiguration("model")),
|
||||
("sim", LaunchConfiguration("sim"))
|
||||
]
|
||||
)
|
||||
|
||||
return [
|
||||
simulation,
|
||||
control,
|
||||
move_group
|
||||
]
|
||||
launch_nodes = []
|
||||
launch_nodes.append(control)
|
||||
launch_nodes.append(simulation)
|
||||
launch_nodes.append(move_group)
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
|
||||
# Launch arguments
|
||||
launch_args = []
|
||||
|
||||
launch_args.append(DeclareLaunchArgument(
|
||||
name="model",
|
||||
default_value="rasms_description",
|
||||
description="Desired LBR model. Use model:=iiwa7/iiwa14/med7/med14."
|
||||
))
|
||||
|
||||
launch_args.append(DeclareLaunchArgument(
|
||||
name="robot_name",
|
||||
default_value="rasms",
|
||||
description="Set robot name."
|
||||
))
|
||||
|
||||
launch_args.append(DeclareLaunchArgument(
|
||||
name="sim",
|
||||
default_value="true",
|
||||
description="Launch robot in simulation or on real setup."
|
||||
))
|
||||
|
||||
launch_args.append(
|
||||
DeclareLaunchArgument(
|
||||
name="controller_configurations_package",
|
||||
default_value="rasms_moveit_config",
|
||||
description="Package that contains controller configurations."
|
||||
)
|
||||
)
|
||||
|
||||
launch_args.append(
|
||||
DeclareLaunchArgument(
|
||||
name="controller_configurations",
|
||||
default_value="config/rasms_controllers.yml",
|
||||
description="Relative path to controller configurations YAML file. Note that the joints in the controllers must be named according to the robot_name."
|
||||
)
|
||||
)
|
||||
|
||||
launch_args.append(
|
||||
DeclareLaunchArgument(
|
||||
name="moveit_controller_configurations_package",
|
||||
default_value="rasms_moveit_config",
|
||||
description="Package that contains MoveIt! controller configurations."
|
||||
)
|
||||
)
|
||||
|
||||
launch_args.append(
|
||||
DeclareLaunchArgument(
|
||||
name="moveit_controller_configurations",
|
||||
default_value="config/rasms_moveit_controllers.yml",
|
||||
description="Relative path to MoveIt! controller configurations YAML file. Note that the joints in the controllers must be named according to the robot_name. This file lists controllers that are loaded through the controller_configurations file."
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
return LaunchDescription(
|
||||
launch_args + [
|
||||
OpaqueFunction(function=launch_setup)
|
||||
])
|
||||
launch_args +
|
||||
launch_nodes
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue