-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic rocker config to install and enable different rmw layers
Only tested with cyclonedds for the moment.
- Loading branch information
Showing
3 changed files
with
77 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Copyright 2024 Open Source Robotics Foundation | ||
|
||
# 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. | ||
|
||
from argparse import ArgumentTypeError | ||
import os | ||
import pkgutil | ||
|
||
from .em import empy_expand | ||
from rocker.extensions import RockerExtension | ||
from rocker.extensions import name_to_argument | ||
|
||
|
||
class RMW(RockerExtension): | ||
@staticmethod | ||
def get_name(): | ||
return 'rmw' | ||
|
||
def __init__(self): | ||
self._env_subs = None | ||
self.name = RMW.get_name() | ||
|
||
def get_docker_args(self, cli_args): | ||
implementation = cli_args.get('rmw') | ||
args = f' -e RMW_IMPLEMENTATION=rmw_{implementation}_cpp' | ||
return args #% self.get_environment_subs() | ||
|
||
def get_environment_subs(self): | ||
if not self._env_subs: | ||
self._env_subs = {} | ||
return self._env_subs | ||
|
||
def get_preamble(self, cliargs): | ||
return '' | ||
|
||
def get_snippet(self, cliargs): | ||
snippet = pkgutil.get_data('rocker', 'templates/%s_snippet.Dockerfile.em' % self.get_name()).decode('utf-8') | ||
data = self.get_environment_subs() | ||
# data['rosdistro'] = cliargs.get('rosdistro', 'rolling') | ||
data['rmw'] = cliargs.get('rmw', None) | ||
# data['rosdistro'] = 'rolling' | ||
return empy_expand(snippet, data) | ||
|
||
@staticmethod | ||
def register_arguments(parser, defaults={}): | ||
parser.add_argument(name_to_argument(RMW.get_name()), | ||
default=defaults.get('rmw', 'fastrtps'), | ||
nargs='?', | ||
help="Set the default RMW implementation") | ||
|
||
# parser.add_argument('rosdistro', | ||
# default=defaults.get('rosdistro', None), | ||
# help="Set the default rosdistro, else autodetect") |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# workspace development helpers | ||
|
||
|
||
@[ if rmw ]@ | ||
RUN if [ -z "${ROS_DISTRO}" ]; then echo "ROS_DISTRO is unset cannot override RMW" ; exit 1 ; fi \ | ||
&& apt-get update \ | ||
&& apt-get install -y \ | ||
ros-${ROS_DISTRO}-rmw-@(rmw)-cpp \ | ||
ros-${ROS_DISTRO}-rmw-dds-common \ | ||
&& apt-get clean | ||
@[ end if ]@ | ||
|
||
# working around recent upgrade of dds-common from 2.x to 3.x which is out of date in the image |