Skip to content

Commit

Permalink
refactor(sensing/image_transport_decompressor): rework parameters (#6746
Browse files Browse the repository at this point in the history
)

* add param, schema file, update readme

Signed-off-by: oguzkaganozt <[email protected]>

* style(pre-commit): autofix

---------

Signed-off-by: oguzkaganozt <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kenzo Lobos Tsunekawa <[email protected]>
Co-authored-by: Yoshi Ri <[email protected]>
  • Loading branch information
4 people authored Jun 10, 2024
1 parent f7ac46f commit 9fd6d55
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
2 changes: 2 additions & 0 deletions sensing/image_transport_decompressor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ The `image_transport_decompressor` is a node that decompresses images.

## Parameters

{{ json_to_markdown("sensing/image_transport_decompressor/schema/image_transport_decompressor.schema.json") }}

## Assumptions / Known limits

## (Optional) Error detection and handling
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/**:
ros__parameters:
encoding: default
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<launch>
<arg name="input_topic_name" default="/input/compressed_image"/>
<arg name="output_topic_name" default="/output/raw_image"/>
<arg name="param_file" default="$(find-pkg-share image_transport_decompressor)/config/image_transport_decompressor.param.yaml"/>

<node pkg="image_transport_decompressor" exec="image_transport_decompressor_node" name="$(anon image_transport_decompressor_node)">
<remap from="~/input/compressed_image" to="$(var input_topic_name)"/>
<remap from="~/output/raw_image" to="$(var output_topic_name)"/>
<param from="$(var param_file)" allow_substs="true"/>
</node>
</launch>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Parameters for Image Transport Decompressor",
"type": "object",
"definitions": {
"image_transport_decompressor": {
"type": "object",
"properties": {
"encoding": {
"type": "string",
"description": "The image encoding to use for the decompressed image",
"default": "default"
}
},
"required": ["encoding"]
}
},
"properties": {
"/**": {
"type": "object",
"properties": {
"ros__parameters": {
"$ref": "#/definitions/image_transport_decompressor"
}
},
"required": ["ros__parameters"]
}
},
"required": ["/**"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ namespace image_preprocessor
{
ImageTransportDecompressor::ImageTransportDecompressor(const rclcpp::NodeOptions & node_options)
: rclcpp::Node("image_transport_decompressor", node_options),
encoding_(declare_parameter("encoding", "default"))
encoding_(declare_parameter<std::string>("encoding"))
{
compressed_image_sub_ = create_subscription<sensor_msgs::msg::CompressedImage>(
"~/input/compressed_image", rclcpp::SensorDataQoS(),
Expand Down

0 comments on commit 9fd6d55

Please sign in to comment.