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

feat(marker_radar_lidar_calibrator): marker_radar_lidar_calibrator support for different radar msgs and transformation algorithms #180

Open
wants to merge 442 commits into
base: tier4/universe
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
442 commits
Select commit Hold shift + click to select a range
fcef24c
fix initial calibration error explanation
vividf May 29, 2024
2f0b9f4
add BEV enviroment
vividf May 29, 2024
7b2ccfe
add vis image for mapping based
vividf May 29, 2024
bab15eb
change to svg file
vividf May 29, 2024
cf135db
fix errors
vividf May 29, 2024
5cd13bb
add resolution explaination
vividf May 29, 2024
0505594
fix lidar to camera
vividf May 29, 2024
f913db4
remove last point
vividf May 29, 2024
57f8dda
seperate the context
vividf May 29, 2024
ef62228
remove accurately
vividf May 29, 2024
b3558ba
remove addtional the
vividf May 29, 2024
e56ecbf
add link
vividf May 29, 2024
23bce5c
fix message to object and add reason of reliably detecting challenge
vividf May 29, 2024
3b945d5
fix section 2
vividf May 29, 2024
a326bb7
improve step 3
vividf May 29, 2024
79c9e47
fix calibration camera
vividf May 29, 2024
b6dfa2b
add docker solution
vividf May 29, 2024
9fe1f4a
fix some sentences in mapping_based
vividf May 29, 2024
793a581
fix the input parameters
vividf Jun 6, 2024
d7a2971
ci(pre-commit): autofix
pre-commit-ci[bot] Jun 6, 2024
a7d466b
chore: applied changes from the auto messages migration
knzo25 Jun 6, 2024
96688a4
chore: mispells
knzo25 Jun 6, 2024
377e88b
chore: another attempt to fix the mispell
knzo25 Jun 6, 2024
a0a8ca9
chore: forgot to commit one .repos file
knzo25 Jun 6, 2024
cf76bb6
chore: replaced private links for public ones
knzo25 Jun 7, 2024
f2e9bb3
chore: fix input
vividf Jun 7, 2024
bd4a440
chore: fix the FAQ
vividf Jun 7, 2024
cb86959
chore: fix radar purpose
vividf Jun 10, 2024
4872fda
predict to estimate
vividf Jun 10, 2024
0c8965d
chore: fix radar vis image
vividf Jun 10, 2024
e013b70
chore: fix foreground extraction
vividf Jun 10, 2024
a5bc527
chore: fix radar step 3 explaination
vividf Jun 10, 2024
55f9b0d
chore: fix add_lidar_radar_pair parameter explanation
vividf Jun 10, 2024
7b7f6fc
chore: fix radar Pro tips/recommendations
vividf Jun 10, 2024
7352fd3
chore: fix radar foreground pointcloud
vividf Jun 10, 2024
1e3e98e
chore: replace the pnp lidar pos to correct one
vividf Jun 10, 2024
eea8ad0
chore: fix didn't to did not
vividf Jun 10, 2024
1a30887
chore: fix tag pos explanation
vividf Jun 10, 2024
1dcb2c6
chore: remove some text
vividf Jun 10, 2024
435cd2a
chore: fix some sentence of mapping
vividf Jun 10, 2024
9c8b4e3
chore: add radar foreground and background image and explanation
vividf Jun 10, 2024
ffcf708
chore: fix parameter desciption
vividf Jun 12, 2024
a2e2659
chore: fix larger to exceed
vividf Jun 12, 2024
50a0fdd
chore: fix grammar errors in mapping based calibrator
vividf Jun 12, 2024
a95f0a2
chore: fix grammar errors in marker based calibrator
vividf Jun 12, 2024
f20ed11
chore: fixed ci/cd
knzo25 Jun 13, 2024
4e29908
chore: ci/cd part 2
knzo25 Jun 13, 2024
c8b7d00
chore: moved meta package's path
knzo25 Jun 13, 2024
aaeaf44
chore: changed private repo to oss one
knzo25 Jun 13, 2024
a2625a9
chore: Update calibrators/marker_radar_lidar_calibrator/README.md
vividf Jun 13, 2024
2cfbbf9
chore: fix marker calibrator algorithms explanation
vividf Jun 13, 2024
13f4a47
chore: add calibration process
vividf Jun 13, 2024
371a57b
chore: remove first
vividf Jun 13, 2024
93c2c52
chore: fix grammar
vividf Jun 13, 2024
f1c5560
chore: remove finalize
vividf Jun 13, 2024
d353ad2
chore: fix Z to z
vividf Jun 13, 2024
fdb76ec
chore: specify yaw rotation
vividf Jun 13, 2024
67263aa
chore: fix all of the explanation for output parameters
vividf Jun 13, 2024
b281496
chore: change predictable
vividf Jun 13, 2024
000c2cd
chore: remove redundant calibration area
vividf Jun 13, 2024
087fa29
fix pro tips
vividf Jun 13, 2024
8c400b5
chore: change to calibrating
vividf Jun 13, 2024
c287aa9
chore: fix more grammar errors
vividf Jun 13, 2024
8802c6c
chore: add more info for the radar foreground image
vividf Jun 17, 2024
fde7a10
chore: add explanation for estimation algorithm
vividf Jun 17, 2024
2996aeb
chore: add svd explanation
vividf Jun 17, 2024
5c897fd
chore: fix radar reflector explanation
vividf Jun 17, 2024
5e37f95
chore: remove while
vividf Jun 17, 2024
b432423
chore: remove angle
vividf Jun 17, 2024
e5ae3ba
chore: fix mapping errors
vividf Jun 17, 2024
806bbac
chore: update calibrators/marker_radar_lidar_calibrator/README.md
vividf Jun 18, 2024
8d3e051
chore: fix grammar
vividf Jun 18, 2024
2d5b949
chore: fix radar pro tips
vividf Jun 18, 2024
bd42460
Merge branch 'feature/new_api_documentation' of github.com:tier4/Cali…
vividf Jun 18, 2024
ac77d58
chore: update calibrators/tag_based_pnp_calibrator/README.md
vividf Jun 18, 2024
d9b2da1
chore: add pnp known issues
vividf Jun 18, 2024
77d9db7
chore: fix grammar error, pnp overall calibration env
vividf Jun 18, 2024
46fc240
chore: fix grammar error: that
vividf Jun 18, 2024
2e2c0fb
chore: fix pnp FAQ
vividf Jun 18, 2024
d0dd65d
chore: add the
vividf Jun 18, 2024
311ad40
chore: reflectors's tracks
vividf Jun 18, 2024
4da5b99
chore: build to mount
vividf Jun 18, 2024
d128d4a
chore: fix final step
vividf Jun 18, 2024
1a8fcb2
chore: add comma
vividf Jun 18, 2024
8a011a5
fix: fix radar foreground points to object
vividf Jun 18, 2024
f32be5c
chore: remove that is
vividf Jun 18, 2024
9e148f0
chore: fix denote as
vividf Jun 18, 2024
6c86225
chore: add explanation for step 4
vividf Jun 18, 2024
f54e8eb
chore: fix services
vividf Jun 18, 2024
2eb4dfb
chore: fix radar parallel frame
vividf Jun 18, 2024
15afdf2
chore: fix transformation type
vividf Jun 18, 2024
69cf81c
chore: add unit1
vividf Jun 18, 2024
aeda57e
chore: add unit2
vividf Jun 18, 2024
b45b9ad
chore: no reflector, person, ...
vividf Jun 18, 2024
b0ce8fc
chore: imperfect to inaccuarate
vividf Jun 18, 2024
76db984
chore: fix object_raw
vividf Jun 18, 2024
33b40dc
chore: fix and to or
vividf Jun 18, 2024
4786ae7
chore: fix show like sentence
vividf Jun 18, 2024
80b05d6
chore: fix link, not in comment
vividf Jun 18, 2024
5981b8f
chore: add explanation for radar foreground
vividf Jun 18, 2024
154f2ef
chore: fix add lidar-radar pair
vividf Jun 19, 2024
6c63f90
chore: fix blue point explanation
vividf Jun 19, 2024
d60a4f4
chore: explain two radar , one lidar
vividf Jun 19, 2024
cfbbf65
chore: line to curve
vividf Jun 19, 2024
99da6e1
chore: change coordinate to frame
vividf Jun 19, 2024
28ee16c
chore: add explanation for ground segmentation in radar-lidar calibrator
vividf Jun 20, 2024
537cb40
chore: add ground segmentation model
vividf Jun 20, 2024
9ffe10c
chore: fixed compilations issues due to changes in universe
knzo25 Jun 21, 2024
ead63ae
chore: colcon ignored the tunable tf package since it produces build …
knzo25 Jun 21, 2024
afdf2b0
Merge branch 'tier4/universe' into feature/new_api_documentation
knzo25 Jun 21, 2024
82cb4ed
chore: attepting to update ci/cd since it seemed old and it was failing
knzo25 Jun 21, 2024
79368af
chore: removed galactic from ci/cd since it is unsupported and was st…
knzo25 Jun 21, 2024
0773803
chore: fixed missing cpell ignores
knzo25 Jun 21, 2024
d66ea14
chore: fix mapping calibrator
vividf Jun 24, 2024
cf912c7
fix: fix spell check
vividf Jun 24, 2024
0a43d3a
fix: fix grammar errors
vividf Jun 24, 2024
4032c15
fix: fix mapping section
vividf Jun 24, 2024
8200499
fix: fix errors
vividf Jun 24, 2024
39650ae
fix: fix grammar error
vividf Jun 24, 2024
5c30563
fix: fix parameters spell check
vividf Jun 24, 2024
2c6ec5a
chore: remove the redundant line
vividf Jun 28, 2024
cbd7507
chore: fix central to center
vividf Jul 1, 2024
aea3a6b
chore: add between sensors
vividf Jul 1, 2024
a64af37
chore: fix grids to grid
vividf Jul 1, 2024
8e4f0de
chore: fix transformation type explanation
vividf Jul 1, 2024
4f7a533
chore: fix rigid transformation estimation
vividf Jul 1, 2024
a064038
chore: add additional explanation
vividf Jul 2, 2024
f63c227
chore: remove processes
vividf Jul 2, 2024
54d8174
chore: change pinpoint to estiamte
vividf Jul 2, 2024
beb8971
chore: fix topic name
vividf Jul 2, 2024
5c6bbfc
chore: fix doesn't to does not
vividf Jul 3, 2024
443a4b5
chore: add more explanation to radar parallel frame
vividf Jul 3, 2024
b16200b
chore: fix topic
vividf Jul 10, 2024
944dc88
chore: unify radar parallel frame and clarify z component
vividf Jul 10, 2024
3d1724a
Update calibrators/docs/tutorials/marker_radar_lidar_calibrator.md
vividf Jul 10, 2024
bcf75b8
Update calibrators/docs/tutorials/tag_based_pnp_calibrator.md
vividf Jul 10, 2024
ea430c7
Update calibrators/docs/tutorials/tag_based_pnp_calibrator.md
vividf Jul 10, 2024
973930c
Update calibrators/marker_radar_lidar_calibrator/README.md
vividf Jul 10, 2024
b516891
chore: fix grammar error
vividf Jul 10, 2024
1e4e601
chore: fix at which
vividf Jul 10, 2024
61b823f
chore: add in seconds unit
vividf Jul 10, 2024
e8a5cba
chore: fix max_no_observation_time
vividf Jul 10, 2024
82ad48e
chore: fix new_hypothesis_distance
vividf Jul 10, 2024
0de1d6d
chore: fix to degrees
vividf Jul 10, 2024
be88f11
chore: fix all square issues
vividf Jul 10, 2024
dcdf2ed
chore: fix lowercase
vividf Jul 10, 2024
11487a6
chore: ARS408 radars
vividf Jul 10, 2024
d3963ac
chore: add missing the
vividf Jul 10, 2024
8bcbc45
chore: fix input_lidar_pointcloud
vividf Jul 10, 2024
285da4b
chore: fix layout
vividf Jul 10, 2024
b38fc0c
chore: fix more layout
vividf Jul 10, 2024
de54522
chore: fix sentences
vividf Jul 10, 2024
f3ffbc4
chore: fix in rviz
vividf Jul 10, 2024
9658988
chore: fix grammar error: of
vividf Jul 10, 2024
c0cc40c
chore: move butoon out
vividf Jul 10, 2024
52ac038
chore: radar_foreground_pointcloud
vividf Jul 10, 2024
64c7f29
chore: remove quotation marks
vividf Jul 10, 2024
fe76fbb
fix: fix mapping based
vividf Jul 10, 2024
f5c8cd2
chore: fix more grammar error
vividf Jul 10, 2024
6dc8fec
Update calibrators/marker_radar_lidar_calibrator/README.md
vividf Jul 12, 2024
dd78b0a
chore: fix all rviz
vividf Jul 12, 2024
1d660e7
chore: fix unit
vividf Jul 12, 2024
f3d6bda
chore: fix detections
vividf Jul 12, 2024
0127eba
chore: fix ARS
vividf Jul 12, 2024
ed14978
chore: fix like below
vividf Jul 12, 2024
b24df51
chore: fix uppercase
vividf Jul 12, 2024
9657dac
chore: fix context in mapping
vividf Jul 12, 2024
cfb2833
chore: remove some text
vividf Jul 12, 2024
db0f07b
chore: fix some grammar
vividf Jul 12, 2024
e1f88ca
Update calibrators/mapping_based_calibrator/README.md
vividf Jul 16, 2024
c0aebe3
Update calibrators/mapping_based_calibrator/README.md
vividf Jul 16, 2024
328d740
Update calibrators/mapping_based_calibrator/README.md
vividf Jul 16, 2024
9c77661
chore: fix spell error
vividf Jul 16, 2024
0669b01
Update calibrators/mapping_based_calibrator/README.md
vividf Jul 16, 2024
73ff155
chore: fix link
vividf Jul 16, 2024
cfe975e
chore: fix known issues grammar
vividf Jul 16, 2024
17822dd
chore: known issues grammar error2
vividf Jul 16, 2024
50f8782
chore: tips for distortion
vividf Jul 16, 2024
9d68e7a
chore: fix all base_link
vividf Jul 16, 2024
11ef573
chore: fix step 2
vividf Jul 16, 2024
abc5356
chore: dense_pointcloud_num_keyframes plural fix
vividf Jul 17, 2024
1a6dc00
chore: for developers
vividf Jul 17, 2024
232658f
chore: keyframe markers and the
vividf Jul 17, 2024
07225d6
chore: extracted from
vividf Jul 17, 2024
2a1aa92
chore: remove ()
vividf Jul 17, 2024
caf5c96
chore: add pro-tips
vividf Jul 17, 2024
f05e4cf
chore: fix step 2 calibration data preparation
vividf Jul 17, 2024
5651786
chore: add processing
vividf Jul 17, 2024
9956c93
chore: fix data selection
vividf Jul 17, 2024
6ab8d87
chore: fix more data selection
vividf Jul 17, 2024
c51e411
chore: would be to identical
vividf Jul 17, 2024
3c26117
chore: could get to obtain
vividf Jul 17, 2024
97f5859
fix: fixed dependencies (due to autoware's autoware prefix)
knzo25 Aug 12, 2024
ff6c871
chore: moved the sensor calibrator manager outside of the calibrators…
knzo25 Aug 12, 2024
1dfc8d7
chore: updated the use of the kalman filter implementation since it w…
knzo25 Aug 20, 2024
52416ae
fix: updated the use of the decompressor
knzo25 Aug 20, 2024
0e5d80f
chore: adapted to the new way of using lidartag
knzo25 Sep 3, 2024
5a7f335
fix: init tf tree visualization (#188)
vividf Sep 10, 2024
48a9072
fix(intrinsic_camera_calibrator): fixed dot board detector (#189)
knzo25 Sep 10, 2024
64d6ad0
docs: candidate for the final documentation of the new api
knzo25 Sep 24, 2024
3b8a2f0
chore: fixed dead links and spelling
knzo25 Sep 24, 2024
61c95dd
chore: fixed missing mispell in a package name
knzo25 Sep 24, 2024
6f78049
chore: fixed missing dead link
knzo25 Sep 24, 2024
e4bf56b
chore: rebase to documentation branch
vividf Jul 23, 2024
609ca2f
changed the name from radar_parallel to radar_optimization, x2 output…
vividf Apr 12, 2024
ecc78a4
integrate with x2, still need to adapt to other
vividf Apr 16, 2024
69c9408
add comment for x2 project
vividf Apr 16, 2024
04381ef
fix spell check
vividf Apr 17, 2024
9767123
fix spell error!
vividf Apr 17, 2024
291a60c
simplify cmake
vividf Apr 25, 2024
946c705
fix the residuals from 4d to 3d
vividf Apr 26, 2024
751ca79
fix variable name and add comment
vividf Apr 26, 2024
965f5c0
fix: fix transformation optimization and add support for radar input …
vividf Jun 26, 2024
80ccf7c
ci(pre-commit): autoupdate (#174)
pre-commit-ci[bot] Jun 26, 2024
0506c2c
chore: remove almost deprecated function
vividf Jul 10, 2024
e1d5856
chore: solve conflicts
vividf Sep 25, 2024
c407e8c
feat: use template for radar input msg
vividf Jul 10, 2024
4e25990
chore: merge docs branch
vividf Jul 16, 2024
8bc24c5
ci(pre-commit): autofix
pre-commit-ci[bot] Jul 23, 2024
f768c20
chore: add option in rdv and x2 launcher
vividf Aug 20, 2024
a1acdc7
ci(pre-commit): autoupdate (#176)
pre-commit-ci[bot] Jul 31, 2024
9bdc336
ci(pre-commit): autoupdate (#184)
pre-commit-ci[bot] Aug 27, 2024
8cc7d93
chore: merge tier4/main to feature branch
vividf Sep 25, 2024
fba02ff
ci(pre-commit): autofix
pre-commit-ci[bot] Sep 25, 2024
2550426
chore: fix spell error
vividf Sep 25, 2024
5b73c2f
chore: fix directory
vividf Sep 25, 2024
cdb0db4
chore: fix docs
vividf Sep 25, 2024
5bf2f5e
chore: fix package dependency
vividf Sep 25, 2024
f954bc4
chore: fix default rviz for text markers
vividf Oct 1, 2024
43189c4
chore: remove unused header
vividf Oct 2, 2024
2d0accd
chore: change function name to evaluateCombinations
vividf Oct 2, 2024
0f648c0
chore: change function name to get2DRotationDelta
vividf Oct 2, 2024
dfc339d
chore: change variable name
vividf Oct 2, 2024
ba05cc4
chore: fix waiting to extract the background model
vividf Oct 2, 2024
e5570b8
chore: fix grammar error
vividf Oct 2, 2024
c1a1ea3
chore: fix function name and clean code
vividf Oct 2, 2024
9bee4d2
chore: remove unnessary logging
vividf Oct 2, 2024
b9e8c9d
chore: fix int to size_t
vividf Oct 2, 2024
12b3562
chore: fix estimateZeroRollTransformation logging
vividf Oct 2, 2024
28fdcf9
chore: add std::size_t
vividf Oct 2, 2024
ef70435
chore: NULL to nullptr
vividf Oct 2, 2024
002d87c
chore: declare point type only once
vividf Oct 2, 2024
a62aae7
chore: remove class member and declare new structure
vividf Oct 3, 2024
b2e2da7
chore: fix description of radar_optimization_frame
vividf Oct 3, 2024
8ab4a0c
chore: remove if condition
vividf Oct 3, 2024
7f7f8e5
chore: fix function name setDelta
vividf Oct 3, 2024
b6c3c69
Revert "chore: remove if condition"
vividf Oct 17, 2024
db3ab9a
chore: fix bug
vividf Oct 18, 2024
64d8e53
chore: fix yaw error
vividf Oct 28, 2024
4a5400d
Merge branch 'tier4/universe' into feature/marker_radar_lidar_calibra…
vividf Oct 28, 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
15 changes: 4 additions & 11 deletions calibrators/marker_radar_lidar_calibrator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,25 @@ cmake_minimum_required(VERSION 3.5)
project(marker_radar_lidar_calibrator)

find_package(autoware_cmake REQUIRED)

autoware_package()

ament_python_install_package(${PROJECT_NAME})
find_package(Ceres REQUIRED)

ament_export_include_directories(
include
${OpenCV_INCLUDE_DIRS}
)
ament_python_install_package(${PROJECT_NAME})

ament_auto_add_executable(marker_radar_lidar_calibrator
src/marker_radar_lidar_calibrator.cpp
src/transformation_estimator.cpp
src/track.cpp
src/main.cpp
)

target_link_libraries(marker_radar_lidar_calibrator
${OpenCV_LIBS}
${CERES_LIBRARIES}
)

install(PROGRAMS
scripts/calibrator_ui_node.py
DESTINATION lib/${PROJECT_NAME}
)

install(PROGRAMS
scripts/metrics_plotter_node.py
DESTINATION lib/${PROJECT_NAME}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <std_srvs/srv/empty.hpp>

#include <geometry_msgs/msg/transform_stamped.hpp>
#include <radar_msgs/msg/radar_scan.hpp>
#include <radar_msgs/msg/radar_tracks.hpp>
#include <sensor_msgs/msg/point_cloud2.hpp>
#include <std_msgs/msg/float32_multi_array.hpp>
Expand All @@ -40,7 +41,6 @@

#include <algorithm>
#include <cstdint>
#include <iostream>
#include <limits>
#include <memory>
#include <mutex>
Expand All @@ -53,11 +53,20 @@
namespace marker_radar_lidar_calibrator
{

struct TransformationResult
{
pcl::PointCloud<common_types::PointType>::Ptr lidar_points_ocs;
pcl::PointCloud<common_types::PointType>::Ptr radar_points_rcs;
Eigen::Isometry3d calibrated_radar_to_lidar_transformation;
};

class ExtrinsicReflectorBasedCalibrator : public rclcpp::Node
{
public:
using PointType = pcl::PointXYZ;
using index_t = std::uint32_t;
enum class TransformationType { svd_2d, yaw_only_rotation_2d, svd_3d, zero_roll_3d };

enum class MsgType { radar_tracks, radar_scan, radar_cloud };

explicit ExtrinsicReflectorBasedCalibrator(const rclcpp::NodeOptions & options);

Expand Down Expand Up @@ -85,28 +94,39 @@ class ExtrinsicReflectorBasedCalibrator : public rclcpp::Node
const std::shared_ptr<std_srvs::srv::Empty::Response> response);

void lidarCallback(const sensor_msgs::msg::PointCloud2::SharedPtr msg);
void radarCallback(const radar_msgs::msg::RadarTracks::SharedPtr msg);

std::vector<Eigen::Vector3d> extractReflectors(
void radarTracksCallback(const radar_msgs::msg::RadarTracks::SharedPtr msg);

void radarScanCallback(const radar_msgs::msg::RadarScan::SharedPtr msg);

void radarCloudCallback(const sensor_msgs::msg::PointCloud2::SharedPtr msg);

template <typename RadarMsgType>
pcl::PointCloud<common_types::PointType>::Ptr extractRadarPointcloud(
const std::shared_ptr<RadarMsgType> & msg);

std::vector<Eigen::Vector3d> extractLidarReflectors(
const sensor_msgs::msg::PointCloud2::SharedPtr msg);
std::vector<Eigen::Vector3d> extractReflectors(const radar_msgs::msg::RadarTracks::SharedPtr msg);
std::vector<Eigen::Vector3d> extractRadarReflectors(
pcl::PointCloud<common_types::PointType>::Ptr radar_pointcloud_ptr);

void extractBackgroundModel(
const pcl::PointCloud<PointType>::Ptr & sensor_pointcloud,
const pcl::PointCloud<common_types::PointType>::Ptr & sensor_pointcloud,
const std_msgs::msg::Header & current_header, std_msgs::msg::Header & last_updated_header,
std_msgs::msg::Header & first_header, BackgroundModel & background_model);

void extractForegroundPoints(
const pcl::PointCloud<PointType>::Ptr & sensor_pointcloud,
const pcl::PointCloud<common_types::PointType>::Ptr & sensor_pointcloud,
const BackgroundModel & background_model, bool use_ransac,
pcl::PointCloud<PointType>::Ptr & foreground_points, Eigen::Vector4f & ground_model);
pcl::PointCloud<common_types::PointType>::Ptr & foreground_points,
Eigen::Vector4f & ground_model);

std::vector<pcl::PointCloud<PointType>::Ptr> extractClusters(
const pcl::PointCloud<PointType>::Ptr & foreground_pointcloud,
std::vector<pcl::PointCloud<common_types::PointType>::Ptr> extractClusters(
const pcl::PointCloud<common_types::PointType>::Ptr & foreground_pointcloud,
const double cluster_max_tolerance, const int cluster_min_points, const int cluster_max_points);

std::vector<Eigen::Vector3d> findReflectorsFromClusters(
const std::vector<pcl::PointCloud<PointType>::Ptr> & clusters,
const std::vector<pcl::PointCloud<common_types::PointType>::Ptr> & clusters,
const Eigen::Vector4f & ground_model);

bool checkInitialTransforms();
Expand All @@ -119,19 +139,27 @@ class ExtrinsicReflectorBasedCalibrator : public rclcpp::Node
const std::vector<std::pair<Eigen::Vector3d, Eigen::Vector3d>> & matches,
builtin_interfaces::msg::Time & time);

std::tuple<pcl::PointCloud<PointType>::Ptr, pcl::PointCloud<PointType>::Ptr, double, double>
getPointsSetAndDelta();
std::tuple<
pcl::PointCloud<common_types::PointType>::Ptr, pcl::PointCloud<common_types::PointType>::Ptr>
getPointsSet();
std::tuple<double, double> get2DRotationDelta(
std::vector<Track> converged_tracks, bool is_crossval);

std::pair<double, double> computeCalibrationError(
const Eigen::Isometry3d & radar_to_lidar_isometry);
void estimateTransformation(
pcl::PointCloud<PointType>::Ptr lidar_points_pcs,
pcl::PointCloud<PointType>::Ptr radar_points_rcs, double delta_cos_sum, double delta_sin_sum);
TransformationResult estimateTransformation();
void evaluateTransformation(Eigen::Isometry3d calibrated_radar_to_lidar_transformation);
void crossValEvaluation(TransformationResult transformation_result);
void findCombinations(
int n, int k, std::vector<int> & curr, int first_num,
std::vector<std::vector<int>> & combinations);
void crossValEvaluation(
pcl::PointCloud<PointType>::Ptr lidar_points_pcs,
pcl::PointCloud<PointType>::Ptr radar_points_rcs);
std::size_t n, std::size_t k, std::vector<std::size_t> & curr, std::size_t first_num,
std::vector<std::vector<std::size_t>> & combinations);
void selectCombinations(
knzo25 marked this conversation as resolved.
Show resolved Hide resolved
std::size_t tracks_size, std::size_t num_of_samples,
std::vector<std::vector<std::size_t>> & combinations);
void evaluateCombinations(
std::vector<std::vector<std::size_t>> & combinations, std::size_t num_of_samples,
TransformationResult transformation_result);

void publishMetrics();
void calibrateSensors();
void visualizationMarkers(
Expand All @@ -142,15 +170,18 @@ class ExtrinsicReflectorBasedCalibrator : public rclcpp::Node
void deleteTrackMarkers();
void drawCalibrationStatusText();
geometry_msgs::msg::Point eigenToPointMsg(const Eigen::Vector3d & p_eigen);
double getYawError(const Eigen::Vector3d & v1, const Eigen::Vector3d & v2);
double getDistanceError(const Eigen::Vector3d v1, const Eigen::Vector3d v2);
double getYawError(const Eigen::Vector3d v1, const Eigen::Vector3d v2);

rcl_interfaces::msg::SetParametersResult paramCallback(
const std::vector<rclcpp::Parameter> & parameters);

struct Parameters
{
std::string radar_parallel_frame; // frame that is assumed to be parallel to the radar (needed
// for radars that do not provide elevation)
std::string radar_optimization_frame; // If the radar does not provide elevation,
// this frame needs to be parallel to the radar
// and should only use the 2D transformation.

bool use_lidar_initial_crop_box_filter;
double lidar_initial_crop_box_min_x;
double lidar_initial_crop_box_min_y;
Expand Down Expand Up @@ -185,7 +216,7 @@ class ExtrinsicReflectorBasedCalibrator : public rclcpp::Node
double max_matching_distance;
double max_initial_calibration_translation_error;
double max_initial_calibration_rotation_error;
int max_number_of_combination_samples;
std::size_t max_number_of_combination_samples;
} parameters_;

// ROS Interface
Expand All @@ -212,7 +243,9 @@ class ExtrinsicReflectorBasedCalibrator : public rclcpp::Node
rclcpp::Publisher<std_msgs::msg::Float32MultiArray>::SharedPtr metrics_pub_;

rclcpp::Subscription<sensor_msgs::msg::PointCloud2>::SharedPtr lidar_sub_;
rclcpp::Subscription<radar_msgs::msg::RadarTracks>::SharedPtr radar_sub_;
rclcpp::Subscription<radar_msgs::msg::RadarTracks>::SharedPtr radar_tracks_sub_;
rclcpp::Subscription<radar_msgs::msg::RadarScan>::SharedPtr radar_scan_sub_;
rclcpp::Subscription<sensor_msgs::msg::PointCloud2>::SharedPtr radar_cloud_sub_;

rclcpp::Service<tier4_calibration_msgs::srv::ExtrinsicCalibrator>::SharedPtr
calibration_request_server_;
Expand All @@ -233,8 +266,12 @@ class ExtrinsicReflectorBasedCalibrator : public rclcpp::Node
Eigen::Isometry3d initial_radar_to_lidar_eigen_;
Eigen::Isometry3d calibrated_radar_to_lidar_eigen_;

geometry_msgs::msg::Transform radar_parallel_to_lidar_msg_;
Eigen::Isometry3d radar_parallel_to_lidar_eigen_;
// radar optimization is the frame that radar optimize the transformation to.
geometry_msgs::msg::Transform radar_optimization_to_lidar_msg_;
Eigen::Isometry3d radar_optimization_to_lidar_eigen_;

geometry_msgs::msg::Transform initial_radar_optimization_to_radar_msg_;
Eigen::Isometry3d initial_radar_optimization_to_radar_eigen_;

bool got_initial_transform_{false};
bool broadcast_tf_{false};
Expand All @@ -254,7 +291,9 @@ class ExtrinsicReflectorBasedCalibrator : public rclcpp::Node
BackgroundModel lidar_background_model_;
BackgroundModel radar_background_model_;

radar_msgs::msg::RadarTracks::SharedPtr latest_radar_msgs_;
radar_msgs::msg::RadarTracks::SharedPtr latest_radar_tracks_msgs_;
radar_msgs::msg::RadarScan::SharedPtr latest_radar_scan_msgs_;
sensor_msgs::msg::PointCloud2::SharedPtr latest_radar_cloud_msgs_;

// Tracking
bool tracking_active_{false};
Expand All @@ -266,6 +305,8 @@ class ExtrinsicReflectorBasedCalibrator : public rclcpp::Node
// Metrics
std::vector<float> output_metrics_;

MsgType msg_type_;
TransformationType transformation_type_;
static constexpr int MARKER_SIZE_PER_TRACK = 8;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright 2024 Tier IV, Inc.
//
// 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.

#ifndef MARKER_RADAR_LIDAR_CALIBRATOR__SENSOR_RESIDUAL_HPP_
#define MARKER_RADAR_LIDAR_CALIBRATOR__SENSOR_RESIDUAL_HPP_

#include <Eigen/Dense>

namespace marker_radar_lidar_calibrator
{

struct SensorResidual
{
SensorResidual(const Eigen::Vector4d & radar_point, const Eigen::Vector4d & lidar_point)
: radar_point_(radar_point), lidar_point_(lidar_point)
{
}

template <class T>
bool operator()(T const * const params, T * s_residuals) const
{
// parameters: x, y, z, pitch, yaw.
Eigen::Matrix<T, 4, 4> transformation_matrix = Eigen::Matrix<T, 4, 4>::Identity(4, 4);
Eigen::Matrix<T, 3, 3> rotation_matrix;

transformation_matrix(0, 3) = T(params[0]);
transformation_matrix(1, 3) = T(params[1]);
transformation_matrix(2, 3) = T(params[2]);

// This rotation matrix is rotate from radar to optimization frames (usually base_link).
// To avoid make sure that the Y axis does not approaches 90 degrees to avoid gimbal lock.
rotation_matrix = (Eigen::AngleAxis<T>(T(params[4]), Eigen::Vector3<T>::UnitZ()) *
Eigen::AngleAxis<T>(T(params[3]), Eigen::Vector3<T>::UnitY()) *
Eigen::AngleAxis<T>(T(0), Eigen::Vector3<T>::UnitX()))
.matrix();

transformation_matrix.block(0, 0, 3, 3) = rotation_matrix;

Eigen::Map<Eigen::Matrix<T, 3, 1>> residuals(s_residuals);
Eigen::Matrix<T, 4, 1> residuals4d =
lidar_point_.cast<T>() - transformation_matrix * radar_point_.cast<T>();
residuals = residuals4d.block(0, 0, 3, 1);

return true;
}

Eigen::Vector4d radar_point_;
Eigen::Vector4d lidar_point_;
};

} // namespace marker_radar_lidar_calibrator

#endif // MARKER_RADAR_LIDAR_CALIBRATOR__SENSOR_RESIDUAL_HPP_
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright 2024 Tier IV, Inc.
//
// 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.

#ifndef MARKER_RADAR_LIDAR_CALIBRATOR__TRANSFORMATION_ESTIMATOR_HPP_
#define MARKER_RADAR_LIDAR_CALIBRATOR__TRANSFORMATION_ESTIMATOR_HPP_

#include <Eigen/Dense>
#include <autoware/universe_utils/geometry/geometry.hpp>
#include <marker_radar_lidar_calibrator/marker_radar_lidar_calibrator.hpp>
#include <marker_radar_lidar_calibrator/types.hpp>
#include <rclcpp/rclcpp.hpp>
#include <tf2_eigen/tf2_eigen.hpp>

#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>

#include <ceres/ceres.h>
#include <pcl/pcl_base.h>
#include <pcl/point_types.h>
#include <pcl/registration/transformation_estimation_svd.h>
#include <tf2/convert.h>

namespace marker_radar_lidar_calibrator
{

class TransformationEstimator
{
public:
TransformationEstimator(
Eigen::Isometry3d initial_radar_to_lidar_eigen,
Eigen::Isometry3d initial_radar_to_radar_optimization_eigen,
Eigen::Isometry3d radar_optimization_to_lidar_eigen);
void setPoints(
pcl::PointCloud<common_types::PointType>::Ptr lidar_points_ocs,
pcl::PointCloud<common_types::PointType>::Ptr radar_points_rcs);
void set2DRotationDelta(double delta_cos, double delta_sin);
void estimateYawOnlyTransformation();
void estimateSVDTransformation(
ExtrinsicReflectorBasedCalibrator::TransformationType transformation_type);
void estimateZeroRollTransformation();
Eigen::Isometry3d getTransformation();

double delta_cos_;
double delta_sin_;
pcl::PointCloud<common_types::PointType>::Ptr lidar_points_ocs_;
pcl::PointCloud<common_types::PointType>::Ptr radar_points_rcs_;
Eigen::Isometry3d calibrated_radar_to_lidar_transformation_;

Eigen::Isometry3d initial_radar_to_lidar_eigen_;
Eigen::Isometry3d initial_radar_optimization_to_radar_eigen_;
Eigen::Isometry3d radar_optimization_to_lidar_eigen_;
};

} // namespace marker_radar_lidar_calibrator

#endif // MARKER_RADAR_LIDAR_CALIBRATOR__TRANSFORMATION_ESTIMATOR_HPP_
Loading