Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/qos-configuration' into …
Browse files Browse the repository at this point in the history
…feature/image-cropping
  • Loading branch information
Kotochleb committed Oct 30, 2024
2 parents 0975852 + 44d6d5a commit 4a658cb
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 19 deletions.
6 changes: 3 additions & 3 deletions happypose_examples/config/cosypose_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
# Specifies which pose estimator to use in the pipeline
pose_estimator_type: "cosypose"
cosypose:
# Name of a dataset used during training
# Name of BOP dataset, used to load specific weights and object models
dataset_name: $(var dataset_name)
# Type of neural network model to use. Available 'pbr'|'synth+real'
model_type: $(var model_type)
# Object renderer parameters
renderer:
# Specifies which renderer to use in the pipeline
renderer_type: "panda3d"
# Number of CPU cores to use during rendering
n_workers: 8
# Render objects on a GPU
gpu_renderer: false
# Parameters expected on the runtime
inference:
# 2D image detection parameters
Expand Down
6 changes: 3 additions & 3 deletions happypose_examples/config/cosypose_params_multiview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
# Specifies which pose estimator to use in the pipeline
pose_estimator_type: "cosypose"
cosypose:
# Name of a dataset used during training
# Name of BOP dataset, used to load specific weights and object models
dataset_name: $(var dataset_name)
# Type of neural network model to use. Available 'pbr'|'synth+real'
model_type: $(var model_type)
# Object renderer parameters
renderer:
# Specifies which renderer to use in the pipeline
renderer_type: "panda3d"
# Number of CPU cores to use during rendering
n_workers: 8
# Render objects on a GPU
gpu_renderer: false
# Parameters expected on the runtime
inference:
# 2D image detection parameters
Expand Down
7 changes: 6 additions & 1 deletion happypose_examples/launch/common.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ def generate_launch_description():
DeclareLaunchArgument(
"dataset_name",
default_value="ycbv",
description="Which dataset to use for inference.",
description="Name of BOP dataset, used to load specific weights and object models.",
),
DeclareLaunchArgument(
"model_type",
default_value="pbr",
description="Type of neural network model to use. Available: 'pbr'|'synth+real'.",
),
DeclareLaunchArgument(
"device",
Expand Down
8 changes: 7 additions & 1 deletion happypose_examples/launch/multi_view_demo.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def launch_setup(
),
launch_arguments={
"dataset_name": LaunchConfiguration("dataset_name"),
"model_type": LaunchConfiguration("model_type"),
"device": LaunchConfiguration("device"),
"use_rviz": LaunchConfiguration("use_rviz"),
"rviz_config_path": rviz_config_path,
Expand All @@ -97,7 +98,12 @@ def generate_launch_description():
DeclareLaunchArgument(
"dataset_name",
default_value="ycbv",
description="Which dataset to use for inference.",
description="Name of BOP dataset, used to load specific weights and object models.",
),
DeclareLaunchArgument(
"model_type",
default_value="pbr",
description="What type of NN model to use, type of training data used, 'pbr'|'synth+real'.",
),
DeclareLaunchArgument(
"device",
Expand Down
14 changes: 8 additions & 6 deletions happypose_ros/happypose_ros/happypose_ros_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,17 @@ happypose_ros:
dataset_name:
type: string
default_value: ""
description: "Name of a dataset used during training."
description: "Name of BOP dataset, used to load specific weights and object models."
validation:
one_of<>: [["hope", "tless", "ycbv"]]
read_only: true
model_type:
type: string
default_value: "pbr"
description: "Type of neural network model to use. Available: 'pbr'|'synth+real'"
validation:
one_of<>: [["pbr", "synth+real"]]
read_only: true
renderer:
renderer_type:
type: string
Expand All @@ -63,11 +70,6 @@ happypose_ros:
validation:
gt_eq<>: 1
read_only: true
gpu_renderer:
type: bool
default_value: true
description: "Render objects on a GPU."
read_only: true
inference:
detector:
detection_th:
Expand Down
1 change: 1 addition & 0 deletions happypose_ros/happypose_ros/inference_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def __init__(self, params: dict) -> None:
# Currently only cosypose is supported
self._wrapper = CosyPoseWrapper(
dataset_name=self._params["cosypose"]["dataset_name"],
model_type=self._params["cosypose"]["model_type"],
**self._params["cosypose"]["renderer"],
)

Expand Down
13 changes: 8 additions & 5 deletions happypose_ros/test/test_initialization_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ def happypose_params(request: pytest.FixtureRequest) -> dict:


@pytest.fixture()
def minial_overwrites() -> List[Parameter]:
def minimal_overwrites() -> List[Parameter]:
"""Crete set minimal set of ROS parameters needed for the ROS node to start correctly.
:return: Default, minimal parameters for the ROS node to start.
:rtype: List[rclpy.Parameter]
"""
return [
Parameter("cosypose.dataset_name", Parameter.Type.STRING, "ycbv"),
Parameter("cosypose.model_type", Parameter.Type.STRING, "pbr"),
Parameter("camera_names", Parameter.Type.STRING_ARRAY, ["cam_1"]),
Parameter("cameras.cam_1.leading", Parameter.Type.BOOL, True),
Parameter("cameras.cam_1.publish_tf", Parameter.Type.BOOL, False),
Expand All @@ -58,6 +59,7 @@ def test_no_leading(happypose_params: dict) -> None:
**happypose_params,
parameter_overrides=[
Parameter("cosypose.dataset_name", Parameter.Type.STRING, "ycbv"),
Parameter("cosypose.model_type", Parameter.Type.STRING, "pbr"),
Parameter(
"camera_names", Parameter.Type.STRING_ARRAY, ["cam_1", "cam_2"]
),
Expand All @@ -69,11 +71,11 @@ def test_no_leading(happypose_params: dict) -> None:


@mock.patch("multiprocessing.context.SpawnContext.Process")
def test_minimal(happypose_params: dict, minial_overwrites: List[Parameter]) -> None:
def test_minimal(happypose_params: dict, minimal_overwrites: List[Parameter]) -> None:
# Check if node starts correctly with minimal number of required parameters
happypose_node = HappyPoseNode(
**happypose_params,
parameter_overrides=minial_overwrites,
parameter_overrides=minimal_overwrites,
)
happypose_node.destroy_node()

Expand All @@ -84,6 +86,7 @@ def test_multiple_leading(happypose_params: dict) -> None:
**happypose_params,
parameter_overrides=[
Parameter("cosypose.dataset_name", Parameter.Type.STRING, "ycbv"),
Parameter("cosypose.model_type", Parameter.Type.STRING, "pbr"),
Parameter(
"camera_names", Parameter.Type.STRING_ARRAY, ["cam_1", "cam_2"]
),
Expand Down Expand Up @@ -114,13 +117,13 @@ def test_leading_publish_tf(happypose_params: dict) -> None:


def test_device_unknown(
happypose_params: dict, minial_overwrites: List[Parameter]
happypose_params: dict, minimal_overwrites: List[Parameter]
) -> None:
with pytest.raises(ParameterException) as excinfo:
HappyPoseNode(
**happypose_params,
parameter_overrides=[
*minial_overwrites,
*minimal_overwrites,
# CUDA -1 is an invalid device
Parameter("device", Parameter.Type.STRING, "cuda:-1"),
],
Expand Down
1 change: 1 addition & 0 deletions happypose_ros/test/test_multi_view.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
pose_estimator_type: "cosypose"
cosypose:
dataset_name: "ycbv"
model_type: "pbr"
# reduce memory footprint during tests by reducing number of workers
renderer:
n_workers: 1
Expand Down
1 change: 1 addition & 0 deletions happypose_ros/test/test_single_view.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
visualization.publish_markers: true
cosypose:
dataset_name: "ycbv"
model_type: "pbr"
# reduce memory footprint during tests by reducing number of workers
renderer:
n_workers: 1
Expand Down

0 comments on commit 4a658cb

Please sign in to comment.