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

Fixed some issues for ROS Noetic #88

Open
wants to merge 2 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 .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "pluginlib"]
path = pluginlib
url = https://github.com/ros/pluginlib
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
- [x] The great introduction and explanation from _`Computer Vision and Perception for Self-Driving Cars Course`_ **[Youtube link](https://youtu.be/cPOtULagNnI?t=4858)**
- [x] SFA3D is used for the second course in the _`Udacity Self-Driving Car Engineer Nanodegree Program: Sensor Fusion and Tracking`_ **[GitHub link](https://github.com/udacity/nd013-c2-fusion-starter/tree/b1455b8ff433cb7f537d62e526209738293e7d8b)**

**Update 2020.09.06**: Add `ROS` source code. The great work has been done by [@AhmedARadwan](https://github.com/AhmedARadwan).
The implementation is [here](https://github.com/maudzung/SFA3D/tree/ea0222c1b35489dc35d8452c989c4b014e20e0da)


## Demonstration (on a single GTX 1080Ti)

Expand All @@ -34,7 +33,7 @@ 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/maudzung/SFA3D.git --recursive
cd SFA3D/
pip install -r requirements.txt
```
Expand Down Expand Up @@ -119,6 +118,14 @@ tensorboard --logdir=./

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

## ROS

You can go to the ros directory for necessary instructions and more information.

**Noetic-Support**:

**Update 2020.09.06**: Add `ROS` source code. The great work has been done by [@AhmedARadwan](https://github.com/AhmedARadwan).
The implementation is [here](https://github.com/maudzung/SFA3D/tree/ea0222c1b35489dc35d8452c989c4b014e20e0da)

## Contact

Expand Down
1 change: 1 addition & 0 deletions pluginlib
Submodule pluginlib added at 5fb0f1
53 changes: 53 additions & 0 deletions ros/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/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)
add_compile_options(-std=c++14)
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/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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
* Copyright 2018-2019 Autoware Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
********************
* v1.0: amc-nu (abrahammonrroy@yahoo.com)
*/

#ifndef _VISUALIZEDETECTEDOBJECTS_H
#define _VISUALIZEDETECTEDOBJECTS_H

#include <vector>
#include <string>
#include <sstream>
#include <cmath>
#include <iomanip>

#include <ros/ros.h>
#include <tf/transform_datatypes.h>

#include <std_msgs/Header.h>

#include <visualization_msgs/MarkerArray.h>
#include <visualization_msgs/Marker.h>

#include "autoware_msgs/DetectedObject.h"
#include "autoware_msgs/DetectedObjectArray.h"

#define __APP_NAME__ "visualize_detected_objects"

class VisualizeDetectedObjects
{
private:
const double arrow_height_;
const double label_height_;
const double object_max_linear_size_ = 200.;
double object_speed_threshold_;
double arrow_speed_threshold_;
double marker_display_duration_;

int marker_id_;

std_msgs::ColorRGBA label_color_, box_color_, hull_color_, arrow_color_, centroid_color_, model_color_;

std::string input_topic_, ros_namespace_;

ros::NodeHandle node_handle_;
ros::Subscriber subscriber_detected_objects_;

ros::Publisher publisher_markers_;

visualization_msgs::MarkerArray ObjectsToLabels(const autoware_msgs::DetectedObjectArray &in_objects);

visualization_msgs::MarkerArray ObjectsToArrows(const autoware_msgs::DetectedObjectArray &in_objects);

visualization_msgs::MarkerArray ObjectsToBoxes(const autoware_msgs::DetectedObjectArray &in_objects);

visualization_msgs::MarkerArray ObjectsToModels(const autoware_msgs::DetectedObjectArray &in_objects);

visualization_msgs::MarkerArray ObjectsToHulls(const autoware_msgs::DetectedObjectArray &in_objects);

visualization_msgs::MarkerArray ObjectsToCentroids(const autoware_msgs::DetectedObjectArray &in_objects);

std::string ColorToString(const std_msgs::ColorRGBA &in_color);

void DetectedObjectsCallback(const autoware_msgs::DetectedObjectArray &in_objects);

bool IsObjectValid(const autoware_msgs::DetectedObject &in_object);

float CheckColor(double value);

float CheckAlpha(double value);

std_msgs::ColorRGBA ParseColor(const std::vector<double> &in_color);

public:
VisualizeDetectedObjects();
};

#endif // _VISUALIZEDETECTEDOBJECTS_H
Loading