write move action with moveit
This commit is contained in:
parent
21d58b5992
commit
8c6b912e00
7 changed files with 102 additions and 55 deletions
|
@ -1,16 +1,55 @@
|
|||
import os
|
||||
import yaml
|
||||
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription, SetEnvironmentVariable
|
||||
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
||||
from launch.substitutions import LaunchConfiguration
|
||||
from launch_ros.actions import Node
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
|
||||
# planning_context
|
||||
robot_description_config = load_file(
|
||||
"rasms_description", "urdf/rasms_description.urdf.xacro"
|
||||
)
|
||||
robot_description = {"robot_description": robot_description_config}
|
||||
|
||||
robot_description_semantic_config = load_file(
|
||||
"rasms_moveit_config", "srdf/rasms_description.srdf"
|
||||
)
|
||||
robot_description_semantic = {
|
||||
"robot_description_semantic": robot_description_semantic_config
|
||||
}
|
||||
|
||||
kinematics_yaml = load_yaml(
|
||||
"rasms_moveit_config", "config/kinematics.yml"
|
||||
)
|
||||
|
||||
pkg_dir = get_package_share_directory('rasms_manipulator')
|
||||
namespace = LaunchConfiguration('namespace')
|
||||
|
||||
|
@ -40,16 +79,21 @@ def generate_launch_description():
|
|||
output='screen',
|
||||
parameters=[
|
||||
pkg_dir + '/config/params.yaml',
|
||||
robot_description,
|
||||
robot_description_semantic,
|
||||
kinematics_yaml,
|
||||
{
|
||||
'action_name': 'move',
|
||||
### [Groot](https://github.com/BehaviorTree/Groot) behavior_tree_visual tool
|
||||
### [](https://intelligentroboticslab.gsyc.urjc.es/ros2_planning_system.github.io/design/index.html)
|
||||
# need to provide visual information about working behavior tree
|
||||
# 'publisher_port': 1668,
|
||||
# 'server_port': 1669,
|
||||
'bt_xml_file': pkg_dir + '/behavior_trees_xml/move.xml'
|
||||
}
|
||||
])
|
||||
transport_1_cmd = Node(
|
||||
package='rasms_manipulator',
|
||||
executable='rasms_action_node',
|
||||
name='transport_1',
|
||||
namespace=namespace,
|
||||
output='screen',
|
||||
parameters=[]) # Create the launch description and populate
|
||||
|
||||
ld = LaunchDescription()
|
||||
|
||||
|
@ -59,5 +103,6 @@ def generate_launch_description():
|
|||
# Declare the launch options
|
||||
ld.add_action(plansys2_cmd)
|
||||
ld.add_action(move_1)
|
||||
# ld.add_action(transport_1_cmd)
|
||||
|
||||
return ld
|
Loading…
Add table
Add a link
Reference in a new issue