Skip to content

Commit

Permalink
Merge branch 'o3r/bugfix/21' into 'master'
Browse files Browse the repository at this point in the history
Remove dependency to OpenCV

See merge request syntron/support/csr/ifm3d/ifm3d-ros2!20
  • Loading branch information
lola-masson committed Apr 19, 2022
2 parents 11aaef7 + f80b1c7 commit 22a7f1e
Show file tree
Hide file tree
Showing 14 changed files with 456 additions and 227 deletions.
13 changes: 13 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Debugger",
"request": "launch",
"type": "cppdbg",
"miDebuggerServerAddress": "localhost:3000",
"cwd": "/",
"program": "/home/usmasslo/ROS/ROS2/ifm3d-ros2-ws/install/ifm3d_ros2/lib/ifm3d_ros2/camera_standalone"
}
]
}
70 changes: 70 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"files.associations": {
"bitset": "cpp",
"memory": "cpp",
"random": "cpp",
"optional": "cpp",
"functional": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"chrono": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"cstdint": "cpp",
"deque": "cpp",
"forward_list": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"iterator": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"ratio": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"ostream": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cinttypes": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"valarray": "cpp",
"strstream": "cpp",
"cfenv": "cpp",
"variant": "cpp"
},
"restructuredtext.confPath": ""
}
28 changes: 28 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ Changelog for package ifm3d-ros2
1.0
===

1.0.1
-----
* Removed dependencies to OpenCV and PCL and the Image module of the ifm3d library. Now using the StlImage module of ifm3d.
* The RGB image is published as a compressed JPEG image. To view it with RViz, you can use the image_transport republish node (see documentation).
* Update the launchfiles for compatibility with pyyaml 6.0 (backward compatibility maintained down to pyyaml 5.1).


1.0.0
--------

Expand All @@ -17,6 +24,7 @@ Changelog for package ifm3d-ros2
* removed unit vector publishing: please use the intrinsic camera calibration parameters instead
* removed the temperature publisher until diagnose chunk is available
* removed axis permutation for ROS node specific axis order
* removed xyz image publisher

known limitations
------------------
Expand Down
9 changes: 3 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ endif()

set(IFM3D_ROS2_DEPS
builtin_interfaces
cv_bridge
lifecycle_msgs
pcl_conversions
rclcpp
rclcpp_components
rclcpp_lifecycle
Expand All @@ -22,13 +20,12 @@ set(IFM3D_ROS2_DEPS
rosidl_default_generators
sensor_msgs
std_msgs
vision_opencv
)

find_package(ifm3d 0.91.0 CONFIG REQUIRED COMPONENTS
find_package(ifm3d 0.93.0 CONFIG REQUIRED COMPONENTS
camera
framegrabber
image
stlimage
)
find_package(ament_cmake_auto REQUIRED)
find_package(ament_cmake_ros REQUIRED)
Expand Down Expand Up @@ -57,7 +54,7 @@ add_library(ifm3d_ros2_camera_node SHARED src/lib/camera_node.cpp)
target_link_libraries(ifm3d_ros2_camera_node
ifm3d::camera
ifm3d::framegrabber
ifm3d::image
ifm3d::stlimage
)
ament_target_dependencies(ifm3d_ros2_camera_node ${IFM3D_ROS2_DEPS})
rclcpp_components_register_nodes(
Expand Down
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ifm3d-ros2

**This release is intended to be used with the O3R camera platform ONLY. For other ifm cameras please see release tag v0.3.0.**
**This release is intended to be used with the O3R camera platform ONLY. For other ifm cameras please see the tagged release 0.3.0.**

**NOTE: The ifm3d-ros2 package has had major changes recently. Please be aware that this might cause problems on your system for building pipelines based on our old build instructions.**
We tried to ensure backward compatibility where ever possible. If you find any major breaks, please let us know.
Expand All @@ -13,6 +13,7 @@ We tried to ensure backward compatibility where ever possible. If you find any m

| ifm3d_ros2 version | ifm3d version | ROS 2 distribution |
| ----------- | ----------- | ----------- |
| 1.0.1 | 0.93.0 | Galactic |
| 1.0.0 | 0.92.0 | Galactic |
| 0.3.0 DEPRECATED | 0.17.0 | Dashing, Eloquent |
| 0.2.0 DEPRECATED | 0.12.0 | Dashing |
Expand All @@ -27,12 +28,7 @@ We tried to ensure backward compatibility where ever possible. If you find any m
### Pre-requisites

1. [ROS2](https://docs.ros.org/en/galactic/Installation.html)
2. [ifm3d](https://ifm.github.io/ifm3d-docs/content/source_build.html) - be sure to build the IMAGE module (using PCL and OPENCV).

In addition to the base packages found in `ros-*-desktop-full` you will need the following ROS packages:
- cv_bridge
- vision_opencv
- pcl-conversions
2. [ifm3d](https://ifm.github.io/ifm3d-docs/content/source_build.html)

These two packages are only required for testing but not at runtime:
- launch_testing
Expand All @@ -41,12 +37,15 @@ These two packages are only required for testing but not at runtime:

On debian based systems they may be installed as follows (replacing `galactic`with your target ROS2 distribution).
```
$ sudo apt install ros-galactic-cv-bridge ros-galactic-vision-opencv ros-galactic-pcl-conversions
$ sudo apt install ros-galactic-launch-testing ros-galactic-launch-testing-ament-cmake
```

You will also need to install boost, which is typically pre-installed in ubuntu distributions, but can be missing when using other platforms:
```
$ sudo apt install ros-galactic-launch-testing ros-galactic-launch-testing-ament-cmake
$ sudo apt install libboost-all-dev
```


### Building from source

Please see the separate building instruction for building from source: [here](doc/building.md)
Expand All @@ -67,6 +66,8 @@ $ ros2 launch ifm3d_ros2 rviz.launch.py
> Note: `rviz.launch.py` does not include the camera node itself, but subscribes to published topics (distance, amplitude, etc). A camera node need to be running in parallel to rviz (you can use `camera_managed.launch`).
> Note also that the `rviz.launch.py` launchfile assumes one data stream publishes at `/ifm3d/camera/<topic_name>`.
:warning: to view the RGB image, follow the instructions [here](doc/view_2d.md).

At this point, you should see an rviz window that looks something like the image below (note that this is the view from 3 camera heads):
![rviz1](doc/figures/O3R_merged_point_cloud.png)

Expand Down Expand Up @@ -110,6 +111,9 @@ None.
| ------ | ------ | ------ |
| Dump | <a href="srv/Dump.srv">ifm3d/Dump</a> | Dumps the state of the camera parameters to JSON |
| Config | <a href="srv/Config.srv">ifm3d/Config</a> | Provides a means to configure the camera and imager settings, declaratively from a JSON encoding of the desired settings. |
| Softon | <a href="srv/Softon.srv">ifm3d/Softon</a> | Provides a means to quickly change the camera state from IDLE to RUN.|
| Softoff | <a href="srv/Softoff.srv">ifm3d/Softoff</a> | Provides a means to quickly change the camera state from RUN to IDLE.|



## Additional Documentation
Expand Down
3 changes: 3 additions & 0 deletions config/param1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/ifm3d_ros2/camera1:
ros__parameters:
pcic_port: 50011
11 changes: 4 additions & 7 deletions doc/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@ We suggest building the `ifm3d-ros2` node on top of Ubuntu 20.04 Focal Fossa and
### ifm3d C++ API
The ROS node `ifm3d_ros2` requires the C++ API ifm3d to be installed locally for your system before compiling and running the ROS node.

Please follow these instructions on how to build `ìfm3d` from source: [build ifm3d from source instructions](https://ifm.github.io/ifm3d-docs/content/source_build.html)
Please follow these instructions on how to build `ifm3d` from source: [build ifm3d from source instructions](ifm3d/doc/sphinx/content/installation_instructions/source_build:Installing%20ifm3d%20from%20source)

> Note: The `image module` is required, so please make sure you build it during your compiling process: the required cmake flag is `-DBUILD_MODULE_IMAGE=ON`
> Note: Both the ifm3d C++ API and the ROS 2 node ifm3d_ros2 depend on OpenCV. We have tested the compatibility between both default `ros-galaciic-libopencv` package available via apt and the `libopencv-dev` dependency as mentioned in the (building instructions for ifm3d)[https://ifm.github.io/ifm3d-docs/content/source_build.html]. For older versions of ROS you might be required to install an older compatible version of `libopencv-dev` as for the C++ API ifm3d as well.

## Step-by-Step build instructions for the ROS node `ifm3d-ros2`

Building and installing ifm3d-ros2 is accomplished by utilizing the ROS2 [colcon](https://colcon.readthedocs.io/en/released/) tool. There are many tutorials and other pieces of advice available online advising how to most effectively utilize it.
Expand All @@ -53,6 +48,8 @@ Next, we need to get the code from GitHub. Please adapt the commands when not fo
$ cd ~/colcon_ws/src
$ git clone https://github.com/ifm/ifm3d-ros2.git
```
> Note: the master branch is generally a work in progress.
> We recommend picking a {{ '[tagged released version]({})'.format(ifm3d_ros2_latest_tag_url) }} for your builds, to ensure stability between builds.
### 4. build the ROS node code
Build your workspace:
Expand All @@ -74,4 +71,4 @@ $ colcon test-result --all
[ ... output omitted ... ]
```

Now that the package is build, continue following our [README](../README.md) instructions for launching the node(s).
Now that the package is build, continue following our [README](../README.md) instructions for launching the node(s).
12 changes: 12 additions & 0 deletions doc/view_2d.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Viewing the RGB image

The RGB image is published on the `/ifm3d/camera*/rgb` topic in a compressed JPEG format.
This is useful to save bandwidth, but cannot be visualized as-is with RViz.

The image can be uncompressed using the `image_transport republish` node:
```bash
$ sudo apt install ros-galactic-compressed-image-transport
$ ros2 run image_transport republish compressed raw --ros-args --remap /in/compressed:=/ifm3d/camera/rgb --remap out:=/uncompressed_rgb
```

In RViz, you can now subscribe to the `/uncompressed_rgb` topic to visualize the RGB image.
Loading

0 comments on commit 22a7f1e

Please sign in to comment.