Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ include_directories(${THIS_PACKAGE_INCLUDE_DIRS})
# add_subdirectory(doc/tests)
# add_subdirectory(doc/trajopt_planner)
# add_subdirectory(doc/creating_moveit_plugins/lerp_motion_planner)
# add_subdirectory(doc/moveit_cpp)
add_subdirectory(doc/moveit_cpp)
# add_subdirectory(doc/collision_environments)
# add_subdirectory(doc/visualizing_collisions)
# add_subdirectory(doc/bullet_collision_checker)
Expand Down
14 changes: 11 additions & 3 deletions doc/moveit_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
add_executable(moveit_cpp_tutorial src/moveit_cpp_tutorial.cpp)
target_link_libraries(moveit_cpp_tutorial ${catkin_LIBRARIES} ${Boost_LIBRARIES})
install(TARGETS moveit_cpp_tutorial DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
target_include_directories(moveit_cpp_tutorial PUBLIC include)
ament_target_dependencies(moveit_cpp_tutorial ${THIS_PACKAGE_INCLUDE_DEPENDS} Boost)

install(DIRECTORY launch DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(TARGETS moveit_cpp_tutorial
DESTINATION lib/${PROJECT_NAME}
)
install(DIRECTORY launch
DESTINATION share/${PROJECT_NAME}
)
install(DIRECTORY config
DESTINATION share/${PROJECT_NAME}
)
15 changes: 15 additions & 0 deletions doc/moveit_cpp/config/controllers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
controller_names:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use the one from moveit_resources

- panda_arm_controller

panda_arm_controller:
action_ns: follow_joint_trajectory
type: FollowJointTrajectory
default: true
joints:
- panda_joint1
- panda_joint2
- panda_joint3
- panda_joint4
- panda_joint5
- panda_joint6
- panda_joint7
38 changes: 20 additions & 18 deletions doc/moveit_cpp/config/moveit_cpp.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
planning_scene_monitor_options:
name: "planning_scene_monitor"
robot_description: "robot_description"
joint_state_topic: "/joint_states"
attached_collision_object_topic: "/planning_scene_monitor"
publish_planning_scene_topic: "/publish_planning_scene"
monitored_planning_scene_topic: "/monitored_planning_scene"
wait_for_initial_state_timeout: 10.0

planning_pipelines:
pipeline_names:
- ompl

plan_request_params:
planning_attempts: 1
planning_pipeline: ompl
max_velocity_scaling_factor: 1.0
max_acceleration_scaling_factor: 1.0
moveit_cpp_tutorial:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move this file to moveit_resources .?

ros__parameters:
planning_scene_monitor_options:
name: "planning_scene_monitor"
robot_description: "robot_description"
joint_state_topic: "/joint_states"
attached_collision_object_topic: "/moveit_cpp/planning_scene_monitor"
publish_planning_scene_topic: "/moveit_cpp/publish_planning_scene"
monitored_planning_scene_topic: "/moveit_cpp/monitored_planning_scene"
wait_for_initial_state_timeout: 10.0

planning_pipelines:
#namespace: "moveit_cpp" # optional, default is ~
pipeline_names: ["ompl"]

plan_request_params:
planning_attempts: 1
planning_pipeline: ompl
max_velocity_scaling_factor: 1.0
max_acceleration_scaling_factor: 1.0
18 changes: 18 additions & 0 deletions doc/moveit_cpp/config/panda_controllers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
panda_arm_controller:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This's for the old ros2_control, we're depending on the master branch now, see run_moveit_cpp.launch.py

ros__parameters:
joints:
- panda_joint1
- panda_joint2
- panda_joint3
- panda_joint4
- panda_joint5
- panda_joint6
- panda_joint7
write_op_modes:
- panda_joint1
- panda_joint2
- panda_joint3
- panda_joint4
- panda_joint5
- panda_joint6
- panda_joint7
19 changes: 19 additions & 0 deletions doc/moveit_cpp/config/start_positions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
fake_joint_driver_node:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This's no longer needed

ros__parameters:
start_position:
joints:
- panda_joint1
- panda_joint2
- panda_joint3
- panda_joint4
- panda_joint5
- panda_joint6
- panda_joint7
values:
- 0.0
- -0.785
- 0.0
- -2.356
- 0.0
- 1.571
- 0.785
4 changes: 0 additions & 4 deletions doc/moveit_cpp/launch/moveit_cpp_node.launch

This file was deleted.

39 changes: 0 additions & 39 deletions doc/moveit_cpp/launch/moveit_cpp_tutorial.launch

This file was deleted.

101 changes: 101 additions & 0 deletions doc/moveit_cpp/launch/moveit_cpp_tutorial.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
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


def generate_launch_description():
# moveit_cpp.yaml is passed by filename for now since it's node specific
moveit_cpp_yaml_file_name = get_package_share_directory('moveit2_tutorials') + "/config/moveit_cpp.yaml"

# Component yaml files are grouped in separate namespaces
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')
robot_description_kinematics = { 'robot_description_kinematics' : kinematics_yaml }

controllers_yaml = load_yaml('moveit2_tutorials', 'config/controllers.yaml')
moveit_controllers = { 'moveit_simple_controller_manager' : controllers_yaml,
'moveit_controller_manager': 'moveit_simple_controller_manager/MoveItSimpleControllerManager'}

ompl_planning_pipeline_config = { 'ompl' : {
'planning_plugin' : 'ompl_interface/OMPLPlanner',
'request_adapters' : """default_planner_request_adapters/AddTimeOptimalParameterization default_planner_request_adapters/FixWorkspaceBounds default_planner_request_adapters/FixStartStateBounds default_planner_request_adapters/FixStartStateCollision default_planner_request_adapters/FixStartStatePathConstraints""" ,
'start_state_max_bounds_error' : 0.1 } }
ompl_planning_yaml = load_yaml('moveit_resources_panda_moveit_config', 'config/ompl_planning.yaml')
ompl_planning_pipeline_config['ompl'].update(ompl_planning_yaml)

# MoveItCpp demo executable
moveit_cpp_node = Node(name='moveit_cpp_tutorial',
package='moveit2_tutorials',
prefix='xterm -e',
executable='moveit_cpp_tutorial',
output='screen',
parameters=[moveit_cpp_yaml_file_name,
robot_description,
robot_description_semantic,
kinematics_yaml,
ompl_planning_pipeline_config,
moveit_controllers])

# RViz
rviz_config_file = get_package_share_directory('moveit2_tutorials') + "/launch/moveit_cpp_tutorial.rviz"
rviz_node = Node(package='rviz2',
executable='rviz2',
name='rviz2',
output='log',
arguments=['-d', rviz_config_file],
parameters=[robot_description,
robot_description_semantic])

# Static TF
static_tf = Node(package='tf2_ros',
executable='static_transform_publisher',
name='static_transform_publisher',
output='log',
arguments=['0.0', '0.0', '0.0', '0.0', '0.0', '0.0', 'world', 'panda_link0'])

# Publish TF
robot_state_publisher = Node(package='robot_state_publisher',
executable='robot_state_publisher',
name='robot_state_publisher',
output='both',
parameters=[robot_description])

# Fake joint driver
fake_joint_driver_node = Node(package='fake_joint_driver',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We no longer depend on fake_joint_driver see

executable='fake_joint_driver_node',
# TODO(JafarAbdi): Why this launch the two nodes (controller manager and the fake joint driver) with the same name!
# name='fake_joint_driver_node',
parameters=[{'controller_name': 'panda_arm_controller'},
os.path.join(get_package_share_directory("moveit2_tutorials"), "config", "panda_controllers.yaml"),
os.path.join(get_package_share_directory("moveit2_tutorials"), "config", "start_positions.yaml"),
robot_description]
)

return LaunchDescription([ static_tf, robot_state_publisher, rviz_node, moveit_cpp_node, fake_joint_driver_node ])
Loading