Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

easier readable Readme, Ros integration #77

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cmake.sourceDirectory": "${workspaceFolder}/ros/src/super_fast_object_detection"
}
69 changes: 68 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![python-image]][python-url]
[![pytorch-image]][pytorch-url]
![ubuntu-image]

---

Expand Down Expand Up @@ -34,9 +35,11 @@ The implementation is [here](https://github.com/maudzung/SFA3D/tree/ea0222c1b354
The instructions for setting up a virtual environment is [here](https://github.com/maudzung/virtual_environment_python3).

```shell script
git clone https://github.com/maudzung/SFA3D.git SFA3D

git clone https://github.com/PanterSoft/SFA3D_ROS.git SFA3D_ROS
cd SFA3D/
pip install -r requirements.txt
pip install .
```

### 2.2. Data Preparation
Expand Down Expand Up @@ -119,6 +122,68 @@ tensorboard --logdir=./

- Then go to [http://localhost:6006/](http://localhost:6006/)

## ROS Integration
### Install dependancies for ROS packages:
```
sudo apt install ros-noetic-autoware-msgs
```
### Build Workspace
```
cd ros/
catkin_make
```

for some users you have to specify which python you want to use in this case execute
```
catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3
```

## Run Inference Node
```
chmod +x /src/super_fast_object_detection/src/rosInference.py
source devel/setup.bash
rosrun super_fast_object_detection rosInference.py
```
## Run Detected Object Visualizer

```
# Terminal 1: Start ROS Master
roscore

# Terminal 2: Start Rviz
rviz rviz

# Terminal 3: Start Inference Node
cd ros/
source devel/setup.bash
rosrun super_fast_object_detection rosInference.py

# Terminal 4: Start Vizualisation Node
cd ros/
source devel/setup.bash
roslaunch detected_objects_visualizer detected_objects_vis.launch

# Terminal 5: Play Rosbag or Live Inference
rosbag play xxxx.bag
```

### Running on Custom Dataset

For running on custom dataset with custom messagenames edit ```rosInference.py``` in ```ros/src/super_fast_object_detection/```

in Line 35-42: class names and the Id´s

in Line 119: path to trained model

in Line 123: cuda device

in Line 131-134: Topic names and message typ

## ROS Topics
### Subscriber
Topic Name: ```points_raw```, Message Type: ```sensor_msgs/PointCloud2```
### Publisher
Topic Name: ```detected_objects```, Message Type: ```autoware_msgs/DetectedObjectArray```

## Contact

Expand Down Expand Up @@ -207,3 +272,5 @@ ${ROOT}
[python-url]: https://www.python.org/
[pytorch-image]: https://img.shields.io/badge/PyTorch-1.5-2BAF2B.svg
[pytorch-url]: https://pytorch.org/

[ubuntu-image]: https://img.shields.io/static/v1?label=Ubuntu&message=20.04&color=orange
53 changes: 53 additions & 0 deletions ros/src/detected_objects_visualizer/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package detected_objects_visualizer
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1.11.0 (2019-03-21)
-------------------
* [fix] Install commands for all the packages (`#1861 <https://github.com/CPFL/Autoware/issues/1861>`_)
* Initial fixes to detection, sensing, semantics and utils
* fixing wrong filename on install command
* Fixes to install commands
* Hokuyo fix name
* Fix obj db
* Obj db include fixes
* End of final cleaning sweep
* Incorrect command order in runtime manager
* Param tempfile not required by runtime_manager
* * Fixes to runtime manager install commands
* Remove devel directory from catkin, if any
* Updated launch files for robosense
* Updated robosense
* Fix/add missing install (`#1977 <https://github.com/CPFL/Autoware/issues/1977>`_)
* Added launch install to lidar_kf_contour_track
* Added install to op_global_planner
* Added install to way_planner
* Added install to op_local_planner
* Added install to op_simulation_package
* Added install to op_utilities
* Added install to sync
* * Improved installation script for pointgrey packages
* Fixed nodelet error for gmsl cameras
* USe install space in catkin as well
* add install to catkin
* Fix install directives (`#1990 <https://github.com/CPFL/Autoware/issues/1990>`_)
* Fixed installation path
* Fixed params installation path
* Fixed cfg installation path
* Delete cache on colcon_release
* * Fixed launch file link on rtm
* display boxes when pose is reliable
* Contributors: Abraham Monrroy Cano, amc-nu

1.10.0 (2019-01-17)
-------------------
* Switch to Apache 2 license (develop branch) (`#1741 <https://github.com/CPFL/Autoware/issues/1741>`_)
* Switch to Apache 2
* Replace BSD-3 license header with Apache 2 and reassign copyright to the
Autoware Foundation.
* Update license on Python files
* Update copyright years
* Add #ifndef/define _POINTS_IMAGE_H\_
* Updated license comment
* change package name to detected_objects_visualizer
* Contributors: Esteve Fernandez, Yukihiro SAITO
96 changes: 96 additions & 0 deletions ros/src/detected_objects_visualizer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
cmake_minimum_required(VERSION 2.8.3)
project(detected_objects_visualizer)

find_package(catkin REQUIRED COMPONENTS
roscpp
autoware_msgs
geometry_msgs
sensor_msgs
tf
visualization_msgs
cv_bridge
image_transport
)

catkin_package(
CATKIN_DEPENDS
roscpp
autoware_msgs
geometry_msgs
sensor_msgs
tf
visualization_msgs
cv_bridge
image_transport
)

find_package(OpenCV REQUIRED)

find_package(Eigen3 QUIET)

if (NOT EIGEN3_FOUND)
find_package(cmake_modules REQUIRED)
find_package(Eigen REQUIRED)
set(EIGEN3_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS})
set(EIGEN3_LIBRARIES ${EIGEN_LIBRARIES})
else ()
set(EIGEN3_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
endif ()

#Rviz Marker visualization
add_executable(visualize_detected_objects
include/visualize_detected_objects.h
src/visualize_detected_objects_main.cpp
src/visualize_detected_objects.cpp
)

target_include_directories(visualize_detected_objects PRIVATE
${OpenCV_INCLUDE_DIR}
${catkin_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
include
)

target_link_libraries(visualize_detected_objects
${OpenCV_LIBRARIES}
${EIGEN3_LIBRARIES}
${catkin_LIBRARIES}
)

add_dependencies(visualize_detected_objects
${catkin_EXPORTED_TARGETS}
)


#Image Rect Visualization
add_executable(visualize_rects
include/visualize_rects.h
src/visualize_rects_main.cpp
src/visualize_rects.cpp
)

target_include_directories(visualize_rects PRIVATE
${OpenCV_INCLUDE_DIR}
${catkin_INCLUDE_DIRS}
include
)

target_link_libraries(visualize_rects
${OpenCV_LIBRARIES}
${catkin_LIBRARIES}
)

add_dependencies(visualize_rects
${catkin_EXPORTED_TARGETS}
)

install(TARGETS
visualize_detected_objects visualize_rects
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(DIRECTORY models/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/models
PATTERN ".svn" EXCLUDE)
55 changes: 55 additions & 0 deletions ros/src/detected_objects_visualizer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Detected Object Visualizer

This node interprets the output of each of the perception nodes and creates the corresponding rviz visualization.

## Parameters

Launch file available parameters:

|Parameter| Type| Description|
----------|-----|--------
|`marker_display_duration`|*Double*|Time in ms to display the marker. Default `0.1`.|
|`object_speed_threshold`|*Double* |Speed threshold to display. Default `0.1`.|
|`arrow_speed_threshold`|*Double*|Arrow speed threshold to display. Default `0.25`.|
|`label_color`|*Array*|Four double values (RGBA), representing the color of the object. Default `[255,255,255,1]`.|
|`arrow_color`|*Array*|Four double values (RGBA), representing the color of the object. Default `[0,255,0,1,0.8]`.|
|`hull_color`|*Array*|Four double values (RGBA), representing the color of the object. Default `[51,204,51,0.8]`.|
|`box_color`|*Array*|Four double values (RGBA), representing the color of the object. Default `[51,128,204,0.8]`.|
|`centroid_color`|*Array*|Four double values (RGBA), representing the color of the object. Default `[77,121,255,0.8]`.|


### Subscribed topics

|Topic|Type|Objective|
------|----|---------
|`ROS_NAMESPACE/objects`|`autoware_msgs/DetectedObjectArray`|Objects Array topic to visualize|

### Published topics

|Topic|Type|Objective|
------|----|---------|
|`ROS_NAMESPACE/objects_markers`|visualization_msgs::MarkerArray|A Label indicating the class and info of the object|

The message includes each of the following namespaces:

|Namespace|Objective|
|------|---------|
|`ROS_NAMESPACE/objects_arrows`|An arrow indicating the direction (`Marker::ARROW`)|
|`ROS_NAMESPACE/objects_hulls`|Convex Hull, the containing polygon (`Marker::LINE_STRIP`)|
|`ROS_NAMESPACE/objects_boxes`|Bounding box containing the object (`Marker::CUBE`)|
|`ROS_NAMESPACE/objects_centroids`|Sphere representing the centroid of the object in space (`Marker::SPHERE`)|
|`ROS_NAMESPACE/objects_mdoels`|Model representing the object in space (`Marker::MESH_RESOURCE`)|

## Notes
This node is already included in the perception nodes' launch file.

If you need to use it manually, be sure to add the `ROS_NAMESPACE` if using `rosrun`.

For launch files, add the following line to your launch file:
```xml
<node pkg="detected_objects_visualizer" type="visualize_detected_objects" name="AN_INSTANCENAME_01"
output="screen" ns="ROS_NAMESPACE"/>
```

i.e. to visualize the output of the `lidar tracker` use `ROS_NAMESPACE=/detection/lidar_tracker` in rosrun or
`ns="/detection/lidar_tracker"` in the launch file.
Loading