Skip to content

Unknown table modeling #51

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

Draft
wants to merge 142 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
e3924a2
create laser subscriber (example, does not work)
PetervDooren Oct 29, 2021
ed2d937
Create table_modeler.cpp
PetervDooren Oct 29, 2021
f1c62a1
Update CMakeLists.txt
PetervDooren Oct 29, 2021
0abc6a1
Start work on loading files, library not working yet
ThijsBeurskensTUE Nov 1, 2021
c6be97f
Fix target linking to pcl
PetervDooren Nov 5, 2021
d2c3d1b
Implement registration algorithm
ThijsBeurskensTUE Nov 15, 2021
d17ffa1
implement transformation matrix, json file not loaded
ThijsBeurskensTUE Nov 18, 2021
c32c1a1
Read out json start
PetervDooren Nov 18, 2021
feb29c7
apply rotation matrix WIP
ThijsBeurskensTUE Nov 19, 2021
9164ad8
Finish rotation matrix
ThijsBeurskensTUE Nov 20, 2021
84ce079
Implement temporary fix rotation matrix, start on segmentation
ThijsBeurskensTUE Nov 22, 2021
af77594
transform from geolib camera pose to ros camera pose
PetervDooren Nov 22, 2021
447f15c
Finish segmentation
ThijsBeurskensTUE Nov 26, 2021
caa3168
Merge remote-tracking branch 'origin/thijs' into thijs
ThijsBeurskensTUE Nov 26, 2021
4491ba1
Remove temporary fix
ThijsBeurskensTUE Nov 26, 2021
5fd99bc
Implement concave hull & table height
ThijsBeurskensTUE Dec 6, 2021
061a443
Implement rectangle sac model
ThijsBeurskensTUE Dec 17, 2021
4d05c2e
rectangle fix
ThijsBeurskensTUE Dec 20, 2021
0879a04
implement double line sac model
ThijsBeurskensTUE Dec 20, 2021
f63aca0
fix distance function in rectangle
ThijsBeurskensTUE Dec 20, 2021
3979409
Implement circle sac model
ThijsBeurskensTUE Dec 23, 2021
0605825
Rewrite height estimation
ThijsBeurskensTUE Dec 30, 2021
0345518
Add options to disable parts of the program
ThijsBeurskensTUE Jan 17, 2022
5a20ea1
initial_commit
Pepijn-Hundepool Apr 28, 2022
5b80acc
hoi
Pepijn-Hundepool Apr 28, 2022
012dba2
horiontal plane attempt
Pepijn-Hundepool May 3, 2022
0dc643b
Nieuwste versie
Pepijn-Hundepool May 17, 2022
618831c
Filter update
Pepijn-Hundepool May 23, 2022
52ef4df
Code before costmap
Pepijn-Hundepool Jun 10, 2022
e08696f
added empty_spot_designator files
PetervDooren Jun 10, 2022
6792251
add dilation
PetervDooren Jun 10, 2022
af5a212
add docstrings for some functions
PetervDooren Aug 15, 2022
042bcac
add remaining contracts
PetervDooren Aug 15, 2022
0cae812
indent tab to spaces
PetervDooren Aug 15, 2022
9c3cd45
comments and formatting
PetervDooren Aug 15, 2022
9e66acd
remove unused rectangle model
PetervDooren Aug 16, 2022
a2be25d
Merge branch 'master' into thijs
PetervDooren Aug 16, 2022
950e8d9
small cleanup of sac model
PetervDooren Aug 16, 2022
a388058
fix indents
PetervDooren Aug 16, 2022
50eb12a
updat docstring of sac models
PetervDooren Aug 16, 2022
81aaf5c
cleanup commented code
PetervDooren Aug 16, 2022
ce99405
fix semicolon
PetervDooren Aug 16, 2022
e6bf91d
cleanup sac models
PetervDooren Aug 16, 2022
019c27e
Merge branch 'BEP_Pepijn' into thijs
PetervDooren Aug 18, 2022
a5e9c3f
made empty_spot_visualizer live
PetervDooren Aug 18, 2022
4ee5226
added segmentation
PetervDooren Aug 20, 2022
68732a5
add_saving of costmap
PetervDooren Aug 22, 2022
ad9e901
fix coordinate system of costmap creation
PetervDooren Aug 22, 2022
22413af
optimise cluster selection
PetervDooren Aug 22, 2022
3ed3ad4
move esd to tools
PetervDooren Sep 12, 2022
905237e
fix world to map y
PetervDooren Sep 12, 2022
9ca1cf2
add pure plane segmentation
PetervDooren Sep 12, 2022
58a24cd
remove deprecated code
PetervDooren Oct 3, 2022
deb1cf5
fix pointer bug
PetervDooren Oct 7, 2022
419bb7e
test
MaxVroonhoven Nov 14, 2022
6a5fcac
test2
MaxVroonhoven Nov 15, 2022
6a97cd6
reverting tests
MaxVroonhoven Nov 15, 2022
2d7b3b4
local test
MaxVroonhoven Nov 15, 2022
dc69636
remove table modeler
MaxVroonhoven Nov 15, 2022
8a248b2
Added objects to bitmap
MaxVroonhoven Nov 17, 2022
4700bca
Occluded space added to bitmap
MaxVroonhoven Nov 18, 2022
21c2033
Added FOV and not table to bitmap
MaxVroonhoven Nov 24, 2022
39d81f9
Added preferred distance + Point extraction
MaxVroonhoven Dec 5, 2022
8d1f004
Placement point costmap
MaxVroonhoven Dec 7, 2022
ce480ad
Initial test on HERO
MaxVroonhoven Dec 8, 2022
e510f15
refactor segmentplane
PetervDooren Dec 9, 2022
c46b68d
Fixed Bug + Added placement radius
MaxVroonhoven Dec 15, 2022
c13e09b
Placement costmap improved
MaxVroonhoven Jan 12, 2023
89792a0
Experiment
MaxVroonhoven Jan 12, 2023
8b538df
Latest Experiment
MaxVroonhoven Jan 17, 2023
87bce74
Improved object filtering
MaxVroonhoven Mar 7, 2023
1f34b82
Use morphological operations instead of PCL data
MaxVroonhoven Mar 21, 2023
2c6e4d3
add service PlaceArea
PetervDooren Apr 1, 2023
a448fd6
Re-introducing additional PCL data
MaxVroonhoven Apr 1, 2023
03ec4b8
add place area class
PetervDooren Apr 1, 2023
3ae3ea2
move implementation to new class
PetervDooren Apr 1, 2023
d88b1f0
remove global variable
PetervDooren Apr 1, 2023
74c81b9
get placement pose
PetervDooren Apr 1, 2023
6e6696e
return from findarea
PetervDooren Apr 1, 2023
9adbd34
implement service
PetervDooren Apr 1, 2023
1f046b1
expand emptyspotdesignator tool
PetervDooren Apr 1, 2023
1d19b63
fill result of service
PetervDooren Apr 1, 2023
bfeac69
add fov test
PetervDooren Apr 1, 2023
94e71c9
DRY
PetervDooren Apr 1, 2023
2b0ecea
fix focal lenght
PetervDooren Apr 1, 2023
f4a4496
add comments and output
PetervDooren Apr 1, 2023
4562a0e
debugging
PetervDooren Apr 1, 2023
16cef6a
Merge branch 'master' into thijs
PetervDooren Apr 7, 2023
9c5500e
fix image buffer import
PetervDooren Apr 7, 2023
5e38ce1
fix unused parameter warnings
PetervDooren Apr 7, 2023
3c52d99
fixed sign comparison warning
PetervDooren Apr 7, 2023
17ef6e5
mark req as unused parameter for now
PetervDooren Apr 7, 2023
e310862
add docstring
PetervDooren Apr 7, 2023
ce69312
newline at eof
PetervDooren Apr 7, 2023
633d15e
Dilating per colour basis (not finished)
MaxVroonhoven Apr 27, 2023
6b58a00
fix faulty merge
MaxVroonhoven Apr 27, 2023
fbb6fe1
Remove morphological implementation + fix comments
MaxVroonhoven Apr 30, 2023
d93ef33
Add dilated/placement canvas for introspection
MaxVroonhoven May 16, 2023
8718828
spacing
PetervDooren Jul 17, 2023
305acab
cleanup functions
PetervDooren Jul 19, 2023
6ca8038
add annotated image functionality (still need to draw the right things)
PetervDooren Jul 19, 2023
b44fd37
annotate plane, objects and not table
PetervDooren Jul 20, 2023
c2fe8c6
fix segfault (i think)
PetervDooren Jul 20, 2023
e9ff555
Merge branch 'master' into thijs
PetervDooren Jul 20, 2023
2b80af5
add marker publishers
PetervDooren Jul 20, 2023
90f2cb1
draw place pose on canvas
PetervDooren Jul 20, 2023
f948868
toggle visualization
PetervDooren Jul 20, 2023
269d14e
Yolov8 for image segmentation
Dyan367 Oct 19, 2023
f115703
add yolo to listener
PetervDooren Oct 19, 2023
ff08f4d
move model into class
PetervDooren Oct 19, 2023
ca39649
changed model from XL to M
PetervDooren Oct 19, 2023
6dc0ca9
converts image to correct colour channel
PetervDooren Oct 19, 2023
256ba86
changed model from M to N
PetervDooren Oct 19, 2023
2ac18d9
added filter for noise onto image
PetervDooren Oct 19, 2023
8a9ead8
removed colour channel change
PetervDooren Oct 19, 2023
817ae80
renamed python script and added cpp script for mapping mask onto image
Dyan367 Dec 7, 2023
6414516
renamed segmentor to segmentation
Dyan367 Dec 7, 2023
7f3050a
added queue size to publisher function
Dyan367 Dec 7, 2023
5ab5970
added queue size to publisher function to listener.py
Dyan367 Dec 7, 2023
1b312e7
changed queue_size =10
Dyan367 Dec 7, 2023
1382032
renamed listener to yolo_table_segmentor, changed from cpu to gpu
Dyan367 Dec 7, 2023
e17fe83
mistake made, assign model to 'cuda' not 'gpu'
Dyan367 Dec 7, 2023
7dd6eee
converted colour channel from BGR to RGB
Dyan367 Dec 7, 2023
86a0ff4
export only mask as binary image
Dyan367 Dec 7, 2023
d78fc5f
export only mask using passthrough instead of mono8
Dyan367 Dec 7, 2023
fae31d3
changed from nano model to large model of yolo
Dyan367 Dec 7, 2023
53e76fa
edited cmakelists for mask_mapper.cpp
Dyan367 Dec 7, 2023
922c0c0
reverted changes to cmakelists
Dyan367 Dec 7, 2023
46452be
swap from rgb image topic to rgbd image topic
Dyan367 Dec 7, 2023
0f1eab4
reverted topic change
Dyan367 Dec 7, 2023
348cb31
empty_sport_visualizer node now subs to hero/segmented_image and can …
Dyan367 Dec 11, 2023
84db852
Merge remote-tracking branch 'origin/master' into thijs
MatthijsBurgh Dec 11, 2023
ae8fb39
find common z depth
Dyan367 Dec 17, 2023
9862a02
paint contour of depth data
Dyan367 Dec 18, 2023
eb18b48
filtered annotated image using segmentation mask
Dyan367 Dec 23, 2023
37b37de
successfully mapped mask into rgbd image using setRGBImage(mask)
Dyan367 Dec 24, 2023
5068594
successfully filtered point cloud using segmentation mask from yolo
Dyan367 Dec 24, 2023
8b0e8fd
perform planar segmentation then filter cloud afterwards so correct h…
Dyan367 Dec 24, 2023
3a1e3d7
Cleaned up code, removed unused functions, added extra arguement to s…
Dyan367 Dec 26, 2023
2013883
final changes, extractMaskFilter needed to be inverted
Dyan367 Jan 8, 2024
4d03dad
using nano model for yolo
Dyan367 Jan 16, 2024
5ef89fd
using XL model for yolo
Dyan367 Jan 16, 2024
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
16 changes: 15 additions & 1 deletion ed_sensor_integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@ find_package(catkin REQUIRED COMPONENTS
geolib2
geometry_msgs
image_geometry
pcl_ros
rgbd
rgbd_image_buffer
rosconsole_bridge
roscpp
sensor_msgs
tf2
tf2_ros
tue_config
tue_filesystem
visualization_msgs
image_transport
cv_bridge
)

# ------------------------------------------------------------------------------------------------
Expand All @@ -30,7 +35,7 @@ find_package(catkin REQUIRED COMPONENTS
catkin_package(
INCLUDE_DIRS include
LIBRARIES ed_kinect
CATKIN_DEPENDS code_profiler ed ${PROJECT_NAME}_msgs geolib2 image_geometry rgbd rgbd_image_buffer roscpp tue_config visualization_msgs
CATKIN_DEPENDS code_profiler ed ${PROJECT_NAME}_msgs geolib2 image_geometry rgbd rgbd_image_buffer roscpp tue_config visualization_msgs image_transport cv_bridge
DEPENDS OpenCV PCL
)

Expand Down Expand Up @@ -66,6 +71,8 @@ add_library(ed_kinect
include/ed/kinect/fitter.h
include/ed/kinect/mesh_tools.h
include/ed/kinect/renderer.h
src/kinect/place_area_finder.cpp
include/ed/kinect/place_area_finder.h
include/ed/kinect/segmenter.h
include/ed/kinect/updater.h

Expand Down Expand Up @@ -171,6 +178,13 @@ install(
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)


add_executable(ed_empty_spot_designator tools/empty_spot_designator.cpp)
target_link_libraries(ed_empty_spot_designator ed_kinect ${catkin_LIBRARIES})

catkin_install_python(PROGRAMS yolo_python/yolo_table_segmentor.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
# ------------------------------------------------------------------------------------------------
# TESTS
# ------------------------------------------------------------------------------------------------
Expand Down
141 changes: 141 additions & 0 deletions ed_sensor_integration/include/ed/kinect/place_area_finder.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
#ifndef ED_KINECT_PLACE_AREA_FINDER_H_
#define ED_KINECT_PLACE_AREA_FINDER_H_


#include <rgbd/image.h>
#include <geolib/datatypes.h>


#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/core/core.hpp>

#include <pcl/filters/filter.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>

/**
* @brief Tool for finding placement options using rgbd sensor information.
*
*/
class PlaceAreaFinder
{

public:

PlaceAreaFinder();

~PlaceAreaFinder();


/**
* @brief find a horizontal surface suitable to place an object
*
* @param image image in which to find a place position
* @param sensor_pose pose of the sensor with respect to a horizontal plane 'base_link' recommended
* @param[out] place_pose expressed in the same frame as sensor pose. One of the possible poses where an object may be placed, currently returns the pose furthest on the table
* @param mask input mask of table obtained from yolov8 segmentation of the rgb image
* @param donal bool used to run either max or donals version of the solution to speed up comparisons
* @return whether or not a suitable place was found
*/
bool findArea(const rgbd::ImageConstPtr& image, geo::Pose3D sensor_pose, geo::Pose3D& place_pose,const cv::Mat &mask,bool donal);

/**
* @brief Get an image of the analysed space, used for introspection
*
* @param[out] image canvas to write the image to.
*/
void getCanvas(cv::Mat& image){ canvas.copyTo(image);}

/**
* @brief Dilate the image, used for introspection
*
* @param[out] image canvas to write the image to.
*/
void getDilatedCanvas(cv::Mat& image){ dilated_canvas.copyTo(image);}

/**
* @brief Shows the available placement points, used for introspection
*
* @param[out] image canvas to write the image to.
*/
void getPlacementCanvas(cv::Mat& image){ placement_canvas.copyTo(image);}

/**
* @brief Shows the annotated image, used for introspection
*
* @param[out] image canvas to write the image to.
*/
void getAnnotatedImage(cv::Mat& image){ annotated_image.copyTo(image);}


private:
// internal occupancy representation
double resolution = 0.005;
cv::Point2d canvas_center;
cv::Mat canvas;
cv::Mat dilated_canvas;
cv::Mat placement_canvas;

cv::Mat annotated_image;

/**
* @brief transform a point in meters to a pixel on the canvas
*
* @param x in meters
* @param y in meters
* @return cv::Point2d
*/
cv::Point2d worldToCanvas(double x, double y);

/**
* @brief inverse of WorldToCanvas
*
* @param point point on the canvas
* @return geo::Vec2d matching point in 2D space
*/
geo::Vec2d canvasToWorld(cv::Point2d point);

//--------------------------------------------------------------------------------------------------------------------------------------
cv::Point2d canvasToWorld2(double u, double v);
void CreateAndVisConvexHull(pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud,float height,pcl::PointCloud<pcl::PointXYZRGB>::Ptr& world_points);
void extractMaskPoints(pcl::PointCloud<pcl::PointXYZRGB>::Ptr inputCloud);
//--------------------------------------------------------------------------------------------------------------------------------------

/**
* @brief Draw the points in a pointcloud on the canvas. will ignore the z direction of the points
*
* @param cloud pointcloud to be rendered
* @param color color to render the points
*/
void createCostmap(pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud, cv::Scalar color);

/**
* @brief morphological dilation
*
* @param canvas image to dilate
* @param dilated_canvas image after dilation
* @param placement_margin radius for dilation in meters! will be converted internally. #TODO remove
*/
void dilateCostmap(cv::Mat& canvas, cv::Mat& dilated_canvas, float placement_margin);

/**
* @brief Draw a Circle on the canvas indicating the prefered distance to the robot. This distance is currently hardcoded.
*
* @param canvas canvas to draw on
* @param color color to draw with
* @param placement_margin
*/
void createRadiusCostmap(cv::Mat& canvas, cv::Scalar color, float placement_margin);

/**
* @brief fill the selected pixels with a color for annotation
*
* @param indeces
* @param color
*/
void annotateImage(const rgbd::Image& image, const pcl::Indices index, cv::Scalar color);

};

#endif
Loading