Skip to content

Commit

Permalink
add .xml launch file
Browse files Browse the repository at this point in the history
  • Loading branch information
Nibanovic committed Apr 8, 2024
1 parent 64b82dd commit 87086b5
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 16 deletions.
14 changes: 7 additions & 7 deletions scripts/setup-robot-moveit.bash
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ for file_type in "${LAUNCH_FILE_TYPES[@]}"; do

# Copy the templates to the destination with the specified file type
cp -n "$MOVEIT_TEMPLATES/moveit.launch${file_type}" "${MOVEIT_LAUNCH}"
done

# sed all needed files
FILES_TO_SED=($MOVEIT_LAUNCH $ROBOT_SRDF $ROBOT_SRDF_MACRO $MOVE_GROUP_CONFIG_YAML $OMPL_PLANNING_CONFIG_YAML)
# sed all needed files
FILES_TO_SED=($MOVEIT_LAUNCH $ROBOT_SRDF $ROBOT_SRDF_MACRO $MOVE_GROUP_CONFIG_YAML $OMPL_PLANNING_CONFIG_YAML)

for SED_FILE in "${FILES_TO_SED[@]}"; do
sed -i "s/\\\$PKG_NAME\\\$/${PKG_NAME}/g" $SED_FILE
sed -i "s/\\\$ROBOT_NAME\\\$/${ROBOT_NAME}/g" $SED_FILE
sed -i "s/\\\$DESCR_PKG_NAME\\\$/${DESCR_PKG_NAME}/g" $SED_FILE
for SED_FILE in "${FILES_TO_SED[@]}"; do
sed -i "s/\\\$PKG_NAME\\\$/${PKG_NAME}/g" $SED_FILE
sed -i "s/\\\$ROBOT_NAME\\\$/${ROBOT_NAME}/g" $SED_FILE
sed -i "s/\\\$DESCR_PKG_NAME\\\$/${DESCR_PKG_NAME}/g" $SED_FILE
done
done

# package.xml: Add dependencies if they not exist
Expand Down
4 changes: 2 additions & 2 deletions templates/moveit/moveit.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def generate_launch_description():
DeclareLaunchArgument(
"semantic_description_file",
default_value="$ROBOT_NAME$.srdf.xacro",
description="MoveIt SRDF/XACRO description file with the robot.. \
description="MoveIt SRDF/XACRO description file with the robot. \
Usually the argument is not set, it enables use of a custom setup.",
)
)
Expand Down Expand Up @@ -170,7 +170,7 @@ def generate_launch_description():
"severity",
default_value="INFO",
choices=["INFO", "WARN", "ERROR", "DEBUG", "FATAL"],
description="Logging level for the nodes",
description="Logging level for the nodes.",
)
)

Expand Down
64 changes: 64 additions & 0 deletions templates/moveit/moveit.launch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!--
Copyright (c) 2024, Stogl Robotics Consulting UG (haftungsbeschränkt)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Source of this file are templates in https://github.com/StoglRobotics/ros_team_workspace repository.
-->

<launch>
<!-- Launch arguments -->
<arg name="description_package" default="$DESCR_PKG_NAME$" description="Package with the robot URDF/XACRO files. Usually the argument is not set, it enables use of a custom setup."/>
<arg name="description_file" default="$ROBOT_NAME$.urdf.xacro" description="URDF/XACRO description file Usually the argument is not set, it enables use of a custom setup"/>
<arg name="moveit_package" default="$PKG_NAME$" description="MoveIt config package with robot SRDF/XACRO files. Usually the argument is not set, it enables use of a custom setup."/>
<arg name="semantic_description_file" default="$ROBOT_NAME$.srdf.xacro" description="MoveIt SRDF/XACRO description file with the robot. Usually the argument is not set, it enables use of a custom setup."/>

<arg name="prefix" default="" description="Prefix of the joint names, useful for multi-robot setup. If changed then also joint names in the controllers' configuration have to be updated."/>
<arg name="use_mock_hardware" default="true" description="Start robot with mock hardware mirroring command to its states." />
<arg name="mock_sensor_commands" default="false" description="Enable mock command interfaces for sensors used for simple simulations. Used only if 'use_mock_hardware' parameter is true."/>
<arg name="use_sim_time" default="false" description="Use simulation clock instead of world clock." />
<arg name="severity" default="INFO" description="Logging level for the nodes. Available levels, in order of severity: DEBUG, INFO, WARN, ERROR, FATAL." />

<!-- Robot parameters -->
<let name="robot_description" value="$(command 'xacro $(find-pkg-share $(var description_package))/urdf/$(var description_file)
prefix:=$(var prefix)
use_mock_hardware:=$(var use_mock_hardware)
mock_sensor_commands:=$(var mock_sensor_commands)
')" />
<let name="robot_description_semantic" value="$(command 'xacro $(find-pkg-share $(var moveit_package))/srdf/$(var semantic_description_file)
prefix:=$(var prefix)
')"/>
<let name="planning_config" value="$(find-pkg-share $(var moveit_package))/config/ompl_planning.yaml"/>
<let name="move_group_config" value="$(find-pkg-share $(var moveit_package))/config/move_group.yaml"/>

<!-- Moveit2 node -->
<node pkg="moveit_ros_move_group" exec="move_group" output="screen"
args="--ros-args --log-level $(var severity)">
<param name="robot_description" value="$(var robot_description)"/>
<param name="robot_description_semantic" value="$(var robot_description_semantic)"/>
<param name="use_sim_time" value="$(var use_sim_time)"/>
<param from="$(var planning_config)"/>
<param from="$(var move_group_config)"/>
</node>

<!-- Rviz2 node -->
<arg name="rviz_config" default="$(find-pkg-share $(var moveit_package))/rviz/moveit.rviz"/>
<node pkg="rviz2" exec="rviz2" output="screen"
args="-d $(var rviz_config) --ros-args --log-level WARN" >
<param name="robot_description" value="$(var robot_description)"/>
<param name="robot_description_semantic" value="$(var robot_description_semantic)"/>
<param name="use_sim_time" value="$(var use_sim_time)"/>
<param from="$(var planning_config)"/>
<param from="$(var move_group_config)"/>
</node>
</launch>
14 changes: 7 additions & 7 deletions templates/moveit/robot_macro.srdf.xacro
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<robot xmlns:xacro="http://wiki.ros.org/xacro">
<xacro:macro name="$ROBOT_NAME$_srdf" params="prefix">
<!--GROUPS: Representation of a set of joints and links. This can be useful for specifying DOF to plan for, defining arms, end effectors, etc-->
<!--GROUPS - Representation of a set of joints and links. This can be useful for specifying DOF to plan for, defining arms, end effectors, etc-->
<group name="${prefix}$ROBOT_NAME$_manipulator">
<chain base_link="${prefix}base_link" tip_link="${prefix}tool0"/>
</group>
<!--LINKS: When a link is specified, the parent joint of that link (if it exists) is automatically included-->
<!--JOINTS: When a joint is specified, the child link of that joint (which will always exist) is automatically included-->
<!--CHAINS: When a chain is specified, all the links along the chain (including endpoints) are included in the group. Additionally, all the joints that are parents to included links are also included. This means that joints along the chain and the parent joint of the base link are included in the group-->
<!--SUBGROUPS: Groups can also be formed by referencing to already defined group names-->
<!--PASSIVE JOINT: Purpose: this element is used to mark joints that are not actuated-->
<!--DISABLE COLLISIONS: By default it is assumed that any link of the robot could potentially come into collision with any other link in the robot.
<!--LINKS - When a link is specified, the parent joint of that link (if it exists) is automatically included-->
<!--JOINTS - When a joint is specified, the child link of that joint (which will always exist) is automatically included-->
<!--CHAINS - When a chain is specified, all the links along the chain (including endpoints) are included in the group. Additionally, all the joints that are parents to included links are also included. This means that joints along the chain and the parent joint of the base link are included in the group-->
<!--SUBGROUPS - Groups can also be formed by referencing to already defined group names-->
<!--PASSIVE JOINT - This element is used to mark joints that are not actuated-->
<!--DISABLE COLLISIONS - By default it is assumed that any link of the robot could potentially come into collision with any other link in the robot.
This tag disables collision checking between a specified pair of links. -->
<disable_collisions link1="${prefix}base_link" link2="${prefix}link1" reason="Adjacent"/>
<disable_collisions link1="${prefix}base_link" link2="${prefix}link2" reason="Adjacent"/>
Expand Down

0 comments on commit 87086b5

Please sign in to comment.