-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use moveit_configs_utils for launch files (#365)
- Loading branch information
Showing
11 changed files
with
95 additions
and
398 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
leak:class_loader | ||
leak:rviz_default_plugins | ||
leak:static_transform_broadcaster_node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,24 @@ | ||
import os | ||
import yaml | ||
from launch import LaunchDescription | ||
from launch_ros.actions import Node | ||
from ament_index_python.packages import get_package_share_directory | ||
|
||
|
||
def load_file(package_name, file_path): | ||
package_path = get_package_share_directory(package_name) | ||
absolute_file_path = os.path.join(package_path, file_path) | ||
|
||
try: | ||
with open(absolute_file_path, "r") as file: | ||
return file.read() | ||
except EnvironmentError: # parent of IOError, OSError *and* WindowsError where available | ||
return None | ||
|
||
|
||
def load_yaml(package_name, file_path): | ||
package_path = get_package_share_directory(package_name) | ||
absolute_file_path = os.path.join(package_path, file_path) | ||
|
||
try: | ||
with open(absolute_file_path, "r") as file: | ||
return yaml.safe_load(file) | ||
except EnvironmentError: # parent of IOError, OSError *and* WindowsError where available | ||
return None | ||
from moveit_configs_utils import MoveItConfigsBuilder | ||
|
||
|
||
def generate_launch_description(): | ||
# Get URDF and SRDF | ||
robot_description_config = load_file( | ||
"moveit_resources_panda_description", "urdf/panda.urdf" | ||
) | ||
robot_description = {"robot_description": robot_description_config} | ||
|
||
robot_description_semantic_config = load_file( | ||
"moveit_resources_panda_moveit_config", "config/panda.srdf" | ||
) | ||
robot_description_semantic = { | ||
"robot_description_semantic": robot_description_semantic_config | ||
} | ||
|
||
kinematics_yaml = load_yaml( | ||
"moveit_resources_panda_moveit_config", "config/kinematics.yaml" | ||
moveit_config = ( | ||
MoveItConfigsBuilder("moveit_resources_panda") | ||
.robot_description(file_path="config/panda.urdf.xacro") | ||
.to_moveit_configs() | ||
) | ||
|
||
cartesian_task = Node( | ||
package="moveit_task_constructor_demo", | ||
executable="cartesian", | ||
output="screen", | ||
parameters=[robot_description, robot_description_semantic, kinematics_yaml], | ||
parameters=[ | ||
moveit_config.robot_description, | ||
moveit_config.robot_description_semantic, | ||
moveit_config.robot_description_kinematics, | ||
], | ||
) | ||
|
||
return LaunchDescription([cartesian_task]) |
Oops, something went wrong.