Skip to content

Commit

Permalink
Use image_transport remapping
Browse files Browse the repository at this point in the history
  • Loading branch information
chapulina committed Oct 17, 2018
1 parent 0ea36b1 commit da044a5
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 55 deletions.
6 changes: 2 additions & 4 deletions gazebo_plugins/test/test_gazebo_ros_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,10 @@ TEST_P(GazeboRosCameraTest, CameraSubscribeTest)
}

INSTANTIATE_TEST_CASE_P(GazeboRosCamera, GazeboRosCameraTest, ::testing::Values(
// TODO(louise) Use mapped topics once this issue is solved:
// https://github.com/ros-perception/image_common/issues/93
TestParams({"worlds/gazebo_ros_camera.world",
"test_cam/camera1/image_raw"}),
"test_cam/camera/image_test"}),
TestParams({"worlds/gazebo_ros_camera_16bit.world",
"test_cam_16bit/test_camera_name/image_raw"})
"test_cam_16bit/image_test_16bit"})
), );

int main(int argc, char ** argv)
Expand Down
14 changes: 6 additions & 8 deletions gazebo_plugins/test/test_gazebo_ros_camera_distortion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,18 +200,16 @@ TEST_P(GazeboRosCameraDistortionTest, CameraSubscribeTest)

INSTANTIATE_TEST_CASE_P(GazeboRosCameraDistortion, GazeboRosCameraDistortionTest,
::testing::Values(
// TODO(louise) Use mapped topics once this issue is solved:
// https://github.com/ros-perception/image_common/issues/93
TestParams({
"worlds/gazebo_ros_camera_distortion_barrel.world",
"undistorted_camera/image_raw",
"distorted_camera/image_raw",
"distorted_camera/camera_info"
"undistorted_image",
"distorted_image",
"distorted_info"
})
// TestParams({"worlds/gazebo_ros_camera_distortion_pincushion.world",
// "undistorted_camera/image_raw",
// "distorted_camera/image_raw",
// "distorted_camera/camera_info"})
// "undistorted_image",
// "distorted_image",
// "distorted_info"})
), );

int main(int argc, char ** argv)
Expand Down
4 changes: 2 additions & 2 deletions gazebo_plugins/test/test_gazebo_ros_camera_triggered.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ TEST_F(GazeboRosTriggeredCameraTest, CameraSubscribeTest)
builtin_interfaces::msg::Time image_stamp;

auto sub = image_transport::create_subscription(node,
"test_triggered_cam/camera1/image_raw",
"test_triggered_cam/image_raw_test",
[&](const sensor_msgs::msg::Image::ConstSharedPtr & msg) {
image_stamp = msg->header.stamp;
++msg_count;
Expand All @@ -63,7 +63,7 @@ TEST_F(GazeboRosTriggeredCameraTest, CameraSubscribeTest)

// Trigger camera once
auto pub = node->create_publisher<std_msgs::msg::Empty>(
"test_triggered_cam/camera1/image_trigger");
"test_triggered_cam/image_trigger_test");
std_msgs::msg::Empty msg;
pub->publish(msg);

Expand Down
3 changes: 1 addition & 2 deletions gazebo_plugins/test/worlds/gazebo_ros_camera.world
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
<plugin name="camera_controller" filename="libgazebo_ros_camera.so">
<ros>
<namespace>test_cam</namespace>
<!-- TODO(louise) Remapping not working due to https://github.com/ros-perception/image_common/issues/93 -->
<argument>image_raw:=image_test</argument>
<argument>camera1/image_raw:=camera/image_test</argument>
<argument>camera_info:=camera_info_test</argument>
</ros>
<!-- camera_name>omit so it defaults to sensor name</camera_name-->
Expand Down
2 changes: 1 addition & 1 deletion gazebo_plugins/test/worlds/gazebo_ros_camera_16bit.world
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<plugin name="camera_controller" filename="libgazebo_ros_camera.so">
<ros>
<namespace>test_cam_16bit</namespace>
<argument>image_raw:=image_test_16bit</argument>
<argument>test_camera_name/image_raw:=image_test_16bit</argument>
<argument>camera_info:=camera_info_test_16bit</argument>
</ros>
<camera_name>test_camera_name</camera_name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@
</camera>
<plugin name="camera_controller" filename="libgazebo_ros_camera.so">
<ros>
<!-- TODO(louise) Remapping not working due to https://github.com/ros-perception/image_common/issues/93 -->
<argument>image_raw:=image_test</argument>
<argument>camera_info:=camera_info_test</argument>
<argument>distorted_camera/image_raw:=distorted_image</argument>
<argument>distorted_camera/camera_info:=distorted_info</argument>
</ros>
<camera_name>distorted_camera</camera_name>
<frame_name>frame_name</frame_name>
Expand Down Expand Up @@ -80,9 +79,7 @@
</camera>
<plugin name="camera_controller" filename="libgazebo_ros_camera.so">
<ros>
<!-- TODO(louise) Remapping not working due to https://github.com/ros-perception/image_common/issues/93 -->
<argument>image_raw:=image_test</argument>
<argument>camera_info:=camera_info_test</argument>
<argument>undistorted_camera/image_raw:=undistorted_image</argument>
</ros>
<camera_name>undistorted_camera</camera_name>
<frame_name>frame_name</frame_name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" ?>
<sdf version="1.4">
<sdf version="1.6">
<world name="default">

<!-- Global light source -->
Expand All @@ -11,13 +11,6 @@
<static>true</static>
<pose>0.0 0.0 2.5 0.0 1.5707 0.0</pose>
<link name="camera_link">
<visual name="camera_visual">
<geometry>
<box>
<size>0.1 0.1 0.1</size>
</box>
</geometry>
</visual>
<sensor type="camera" name="camera_distorted">
<update_rate>30.0</update_rate>
<camera name="head">
Expand Down Expand Up @@ -46,12 +39,10 @@
</camera>
<plugin name="camera_controller" filename="libgazebo_ros_camera.so">
<ros>
<namespace>test_cam_distorted</namespace>
<!-- TODO(louise) Remapping not working due to https://github.com/ros-perception/image_common/issues/93 -->
<argument>image_raw:=image_test</argument>
<argument>camera_info:=camera_info_test</argument>
<argument>distorted_camera/image_raw:=distorted_image</argument>
<argument>distorted_camera/camera_info:=distorted_info</argument>
</ros>
<camera_name>camera_name</camera_name>
<camera_name>distorted_camera</camera_name>
<frame_name>frame_name</frame_name>
<hack_baseline>0.07</hack_baseline>
<border_crop>false</border_crop>
Expand All @@ -64,13 +55,6 @@
<static>true</static>
<pose>0.0 0.0 2.5 0.0 1.5707 0.0</pose>
<link name="camera_link">
<visual name="camera_visual">
<geometry>
<box>
<size>0.1 0.1 0.1</size>
</box>
</geometry>
</visual>
<sensor type="camera" name="camera_undistorted">
<update_rate>30.0</update_rate>
<camera name="head">
Expand All @@ -95,14 +79,10 @@
</camera>
<plugin name="camera_controller" filename="libgazebo_ros_camera.so">
<ros>
<namespace>test_cam_undistorted</namespace>
<!-- TODO(louise) Remapping not working due to https://github.com/ros-perception/image_common/issues/93 -->
<argument>image_raw:=image_test</argument>
<argument>camera_info:=camera_info_test</argument>
<argument>undistorted_camera/image_raw:=undistorted_image</argument>
</ros>
<camera_name>camera_name</camera_name>
<camera_name>undistorted_camera</camera_name>
<frame_name>frame_name</frame_name>
<hack_baseline>0.0</hack_baseline>
</plugin>
</sensor>
</link>
Expand All @@ -111,5 +91,5 @@
<include>
<uri>model://checkerboard_plane</uri>
</include>
</world>
</world>
</sdf>
7 changes: 2 additions & 5 deletions gazebo_plugins/test/worlds/gazebo_ros_camera_triggered.world
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,8 @@
<plugin name="camera_controller" filename="libgazebo_ros_camera.so">
<ros>
<namespace>test_triggered_cam</namespace>
<!-- TODO(louise) Remapping not working due to
https://github.com/ros-perception/image_common/issues/93 -->
<argument>image_raw:=image_test</argument>
<argument>camera_info:=camera_info_test</argument>
<argument>image_trigger:=image_trigger_test</argument>
<argument>camera1/image_raw:=image_raw_test</argument>
<argument>camera1/image_trigger:=image_trigger_test</argument>
</ros>
<triggered>true</triggered>
<hack_baseline>0.07</hack_baseline>
Expand Down

0 comments on commit da044a5

Please sign in to comment.