Skip to content

Commit

Permalink
Update launch file, configuration and then README to match (#20)
Browse files Browse the repository at this point in the history
Update launch file, configuration and readme
  • Loading branch information
adamantivm authored Jul 6, 2021
1 parent e76f146 commit 34420b9
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
7 changes: 3 additions & 4 deletions massrobotics_amr_sender_py/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mkdir -p ~/ros2_ws/src && cd ros2_ws/
# Clone the repo inside the workspace
git clone https://github.com/inorbit-ai/ros_amr_interop.git ./src
# Install dependencies
rosdep install --ignore-src --from-paths src/
rosdep update && rosdep install --ignore-src --from-paths src/
# Run the build
colcon build --packages-select massrobotics_amr_sender
```
Expand All @@ -39,9 +39,8 @@ The node takes the MassRobotics AMR config file path as parameter. If not provid
```bash
# Remember to source the ROS2 environment from the binary installation or your workspace overlay
source install/setup.bash
# Run the node pointing to your configuration file
ros2 run massrobotics_amr_sender massrobotics_amr_node \
--ros-args -p config_file:=/path/to/config.yaml --log-level debug
# Launch the node pointing to your configuration file
ros2 launch massrobotics_amr_sender massrobotics_amr_sender.launch.py config_file:=/path/to/config.yaml
```


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@
from launch.substitutions import ThisLaunchFileDir
from launch_ros.actions import Node

from ament_index_python.packages import get_package_share_directory

def generate_launch_description():
my_package_share_dir = get_package_share_directory('massrobotics_amr_sender')

return LaunchDescription([
DeclareLaunchArgument(
'mass_config_file',
default_value=[
PathJoinSubstitution([ThisLaunchFileDir(), '..', 'sample_config.yaml'])
],
'config_file',
default_value=PathJoinSubstitution([my_package_share_dir, 'params', 'sample_config.yaml']),
description='massrobotics_amr_sender node configuration file'
),
Node(
Expand All @@ -50,7 +51,7 @@ def generate_launch_description():
executable='massrobotics_amr_node',
name='massrobotics_amr_sender',
parameters=[
{'config_file': LaunchConfiguration('mass_config_file')}
{'config_file': LaunchConfiguration('config_file')}
]
),
])
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __init__(self, **kwargs) -> None:
# Declare Node configuration parameter. Defaults to './config.yaml' if no
# ``config_file`` parameter is provided. Provide the parameter when running
# the node by using ``--ros-args -p config_file:=/path/to/config.yaml``
self.declare_parameter('config_file', './config.yaml')
self.declare_parameter('config_file', 'config.yaml')
config_file_param = self.get_parameter(name='config_file')
config_file_path = config_file_param.get_parameter_value().string_value
self._config = self._read_config_file(config_file_path=config_file_path)
Expand Down
10 changes: 9 additions & 1 deletion massrobotics_amr_sender_py/setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
from setuptools import setup, find_packages
import xml.etree.ElementTree as ET
import os
from glob import glob

# Read version from ``package.xml`` file
package_xml = ET.parse('package.xml').getroot()

package_name = 'massrobotics_amr_sender'

share_dir = os.path.join('share', package_name)

setup(
name=package_name,
packages=find_packages(),
Expand All @@ -15,7 +19,11 @@
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + package_name, ['package.xml']),
(share_dir, ['package.xml']),
# Include launch files
(share_dir, glob('launch/*.launch.py')),
# Sample config files
(os.path.join(share_dir, 'params'), [os.path.join('params', 'sample_config.yaml')]),
],
install_requires=['setuptools'],
zip_safe=True,
Expand Down

0 comments on commit 34420b9

Please sign in to comment.