Skip to content

Commit

Permalink
Add ros2_node cli (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
lalten authored Apr 18, 2023
1 parent fb8ff9f commit 03c895e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Available features:
- Zero copy transport via shared memory backend ([iceoryx](https://github.com/eclipse-iceoryx/iceoryx)) for CycloneDDS.
- Utilities:
- `ros2_bag` for handling rosbags
- `ros2_node` for handling nodes
- `ros2_param` for handling parameters
- `ros2_service` for handling services
- `ros2_topic` for handling topics
Expand Down
10 changes: 10 additions & 0 deletions ros2/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ py_library(
],
)

py_binary(
name = "ros2_node",
srcs = ["ros2_node.py"],
visibility = ["//visibility:public"],
deps = [
":ros2_cmd",
"@ros2cli//:ros2node",
],
)

py_binary(
name = "ros2_param",
srcs = ["ros2_param.py"],
Expand Down
28 changes: 28 additions & 0 deletions ros2/ros2_node.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2023 Laurenz Altenmueller
#
# 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.
import sys

import ros2cli.cli
import ros2node.verb.info
import ros2node.verb.list

import ros2.ros2_cmd

COMMAND_EXTENSIONS = {
'info': ros2node.verb.info.InfoVerb(),
'list': ros2node.verb.list.ListVerb(),
}

extension = ros2.ros2_cmd.Ros2CommandExtension(COMMAND_EXTENSIONS)
sys.exit(ros2cli.cli.main(argv=sys.argv[1:], extension=extension))

0 comments on commit 03c895e

Please sign in to comment.