Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
ros_camera_bev
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yangxue
ros_camera_bev
Commits
adab96f8
Commit
adab96f8
authored
Apr 17, 2025
by
yangxue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add lidar2vechicle mutex
parent
c1348888
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
20 deletions
+24
-20
README.md
README.md
+3
-2
sensor_manager.cpp
src/camera_bev_infer/src/sensor_manager.cpp
+8
-2
sensor_manager.h
src/camera_bev_infer/src/sensor_manager.h
+13
-16
No files found.
README.md
View file @
adab96f8
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
*
@Author: yangxue && xue.yang@waytous.com
*
@Author: yangxue && xue.yang@waytous.com
*
@Date: 2025-04-07 09:26:17
*
@Date: 2025-04-07 09:26:17
*
@LastEditors: yangxue xue.yang@waytous.com
*
@LastEditors: yangxue xue.yang@waytous.com
*
@LastEditTime: 2025-04-
08 06:24:07
*
@LastEditTime: 2025-04-
10 09:45:19
*
@FilePath: /ubuntu/projects/ros_camera_bev/README.md
*
@FilePath: /ubuntu/projects/ros_camera_bev/README.md
*
@Description:
*
@Description:
*
*
...
@@ -58,5 +58,5 @@ rviz
...
@@ -58,5 +58,5 @@ rviz
```
```
# 压缩部署关键文件
# 压缩部署关键文件
```
```
zip -r ros_camera_bev.zip ros_camera_bev/ -x "ros_camera_bev/.vscode/*" -x "ros_camera_bev/devel/*" -x "ros_camera_bev/build/*" -x "ros_camera_bev/sdk/*" -x "ros_camera_bev/src/camera_back_warn/*" -x "*.engine" -x "*.bag" -x "ros_camera_bev/.git/*"
zip -r ros_camera_bev.zip ros_camera_bev/ -x "ros_camera_bev/.vscode/*" -x "ros_camera_bev/devel/*" -x "ros_camera_bev/build/*" -x "ros_camera_bev/sdk/*" -x "ros_camera_bev/src/camera_back_warn/*" -x "*.engine" -x "*.bag" -x "ros_camera_bev/.git/*"
-x "*.gitignore"
```
```
\ No newline at end of file
src/camera_bev_infer/src/sensor_manager.cpp
View file @
adab96f8
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* @Date: 2023-09-03 02:18:07
* @Date: 2023-09-03 02:18:07
* @email: xin.wang@waytous.com
* @email: xin.wang@waytous.com
* @LastEditors: yangxue xue.yang@waytous.com
* @LastEditors: yangxue xue.yang@waytous.com
* @LastEditTime: 2025-04-1
0 06:31:09
* @LastEditTime: 2025-04-1
7 03:47:34
*/
*/
...
@@ -171,7 +171,11 @@ void sensorManager::publishDetection()
...
@@ -171,7 +171,11 @@ void sensorManager::publishDetection()
if
(
point_cloud_ptr
!=
nullptr
){
if
(
point_cloud_ptr
!=
nullptr
){
Cloud
::
Ptr
pcl_cloud
(
new
Cloud
);
Cloud
::
Ptr
pcl_cloud
(
new
Cloud
);
{
std
::
lock_guard
<
std
::
mutex
>
lock_
(
pointcloud_mutex
);
pcl
::
fromROSMsg
(
*
point_cloud_ptr
,
*
pcl_cloud
);
pcl
::
fromROSMsg
(
*
point_cloud_ptr
,
*
pcl_cloud
);
}
// 2d->bev,结果保存到vGrid中 (frame->objs_有track_id, vGrid->vInsObjs没有)
// 2d->bev,结果保存到vGrid中 (frame->objs_有track_id, vGrid->vInsObjs没有)
// vision_converter_->Process_objects(frame_ptr->img_src_, pcl_cloud, frame_ptr->objs_, *vGrid);
// vision_converter_->Process_objects(frame_ptr->img_src_, pcl_cloud, frame_ptr->objs_, *vGrid);
vision_converter_
->
Process_objects
(
frame_ptr
->
img_src_
,
frame_ptr
->
depth_
,
pcl_cloud
,
frame_ptr
->
objs_
,
*
vGrid
);
vision_converter_
->
Process_objects
(
frame_ptr
->
img_src_
,
frame_ptr
->
depth_
,
pcl_cloud
,
frame_ptr
->
objs_
,
*
vGrid
);
...
@@ -229,9 +233,11 @@ void sensorManager::publishDetection()
...
@@ -229,9 +233,11 @@ void sensorManager::publishDetection()
*
::
Eigen
::
AngleAxisd
(
ea0
[
2
],
::
Eigen
::
Vector3d
::
UnitZ
());
*
::
Eigen
::
AngleAxisd
(
ea0
[
2
],
::
Eigen
::
Vector3d
::
UnitZ
());
::
Eigen
::
Quaterniond
orient
;
::
Eigen
::
Quaterniond
orient
;
orient
=
matR
;
orient
=
matR
;
{
std
::
lock_guard
<
std
::
mutex
>
lock_
(
tf_mutex
);
ob
.
pose
.
position
.
x
=
pos
.
x
+
lidar2vehicle_
(
0
,
3
);
ob
.
pose
.
position
.
x
=
pos
.
x
+
lidar2vehicle_
(
0
,
3
);
ob
.
pose
.
position
.
y
=
pos
.
y
+
lidar2vehicle_
(
1
,
3
);
ob
.
pose
.
position
.
y
=
pos
.
y
+
lidar2vehicle_
(
1
,
3
);
}
ob
.
pose
.
position
.
z
=
0
;
ob
.
pose
.
position
.
z
=
0
;
ob
.
pose
.
orientation
.
x
=
orient
.
x
();
ob
.
pose
.
orientation
.
x
=
orient
.
x
();
ob
.
pose
.
orientation
.
y
=
orient
.
y
();
ob
.
pose
.
orientation
.
y
=
orient
.
y
();
...
...
src/camera_bev_infer/src/sensor_manager.h
View file @
adab96f8
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* @Date: 2023-09-03 01:53:20
* @Date: 2023-09-03 01:53:20
* @email: xin.wang@waytous.com
* @email: xin.wang@waytous.com
* @LastEditors: yangxue xue.yang@waytous.com
* @LastEditors: yangxue xue.yang@waytous.com
* @LastEditTime: 2025-04-1
0 06:33:42
* @LastEditTime: 2025-04-1
7 03:46:30
*/
*/
#ifndef SENSORMANAGER_H
#ifndef SENSORMANAGER_H
...
@@ -149,30 +149,21 @@ public:
...
@@ -149,30 +149,21 @@ public:
std
::
lock_guard
<
std
::
mutex
>
lock_
(
pointcloud_mutex
);
std
::
lock_guard
<
std
::
mutex
>
lock_
(
pointcloud_mutex
);
pc_timestamp_sys_
=
GetMillSecondTimeStamp
();
pc_timestamp_sys_
=
GetMillSecondTimeStamp
();
current_pointcloud_
=
pdata
;
if
(
!
is_lidar2vehicle_
)
{
std
::
lock_guard
<
std
::
mutex
>
lock_
(
tf_mutex
);
std
::
cout
<<
"get lidar2vehicle transform"
<<
std
::
endl
;
ros
::
Time
input_time
=
pdata
->
header
.
stamp
;
ros
::
Time
input_time
=
pdata
->
header
.
stamp
;
std
::
string
cloud_frame
=
pdata
->
header
.
frame_id
;
std
::
string
cloud_frame
=
pdata
->
header
.
frame_id
;
current_pointcloud_
=
pdata
;
// // 初始化 current_pointcloud_
// current_pointcloud_ = boost::make_shared<sensor_msgs::PointCloud2>();
// // std::cout << "get lidar2vehicle & transform pc to vehicle frame: base_frame:" << base_frame_ << ", lidar frame:" << cloud_frame << std::endl;
tran_
->
waitForTransform
(
base_frame_
,
cloud_frame
,
input_time
,
ros
::
Duration
(
10
.
0
));
// destination_frame, original_frame, cant tf tree receive
tran_
->
waitForTransform
(
base_frame_
,
cloud_frame
,
input_time
,
ros
::
Duration
(
10
.
0
));
// destination_frame, original_frame, cant tf tree receive
tran_
->
lookupTransform
(
base_frame_
,
cloud_frame
,
ros
::
Time
(
0
),
lidar2vehicle_tf_
);
tran_
->
lookupTransform
(
base_frame_
,
cloud_frame
,
ros
::
Time
(
0
),
lidar2vehicle_tf_
);
// pcl_ros::transformPointCloud(base_frame_, *pdata, *current_pointcloud_, *tran_);
// std::cout << "current_pointcloud_ header: " << current_pointcloud_->header.stamp << std::endl;
// std::cout << "current_pointcloud_ frame_id: " << current_pointcloud_->header.frame_id << std::endl;
// std::cout << "update lidar2camera with lidar2vehicle_: " << std::endl;
// update lidar2camera with lidar2vehicle_
// update lidar2camera with lidar2vehicle_
lidar2vehicle_
=
transformTFToEigen
(
lidar2vehicle_tf_
);
lidar2vehicle_
=
transformTFToEigen
(
lidar2vehicle_tf_
);
is_lidar2vehicle_
=
true
;
// Eigen::Matrix4d camera2lidar = infer_param.cameraParam_->camera2lidar_extrinsic;
}
// Eigen::Matrix4d camera2lidar_new = lidar2vehicle * camera2lidar; // camera2vehicle actually!
// std::cout << "camera2lidar: \n" << camera2lidar << std::endl;
// std::cout << "lidar2vehicle: \n" << lidar2vehicle_ << std::endl;
// vision_converter_->setLidar2Camera(camera2lidar_new.inverse());
}
}
};
};
...
@@ -192,7 +183,11 @@ public:
...
@@ -192,7 +183,11 @@ public:
if
(
std
::
abs
(
tm_now
-
pc_timestamp_sys_
)
>
pc_timevalid_interval_
){
if
(
std
::
abs
(
tm_now
-
pc_timestamp_sys_
)
>
pc_timevalid_interval_
){
current_pointcloud_
=
nullptr
;
current_pointcloud_
=
nullptr
;
}
}
if
(
temp
==
nullptr
)
{
std
::
cout
<<
"getCurPointcloud: nullptr"
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"getCurPointcloud: "
<<
temp
->
header
.
stamp
<<
std
::
endl
;
std
::
cout
<<
"getCurPointcloud: "
<<
temp
->
header
.
stamp
<<
std
::
endl
;
}
return
temp
;
return
temp
;
}
}
}
}
...
@@ -224,6 +219,7 @@ private:
...
@@ -224,6 +219,7 @@ private:
std
::
string
base_frame_
=
"vehicle_link"
;
// 目标坐标系
std
::
string
base_frame_
=
"vehicle_link"
;
// 目标坐标系
tf
::
StampedTransform
lidar2vehicle_tf_
;
// lidar-vehicle transform
tf
::
StampedTransform
lidar2vehicle_tf_
;
// lidar-vehicle transform
Eigen
::
Matrix4d
lidar2vehicle_
;
Eigen
::
Matrix4d
lidar2vehicle_
;
bool
is_lidar2vehicle_
=
false
;
// 是否有lidar-vehicle transform
ros
::
Publisher
obj_publisher_
;
// 交通障碍物发布者
ros
::
Publisher
obj_publisher_
;
// 交通障碍物发布者
ros
::
Subscriber
image_subscriber_
;
// 图像订阅者
ros
::
Subscriber
image_subscriber_
;
// 图像订阅者
...
@@ -233,6 +229,7 @@ private:
...
@@ -233,6 +229,7 @@ private:
std
::
mutex
image_mutex
;
// 管理图像信息的互斥量
std
::
mutex
image_mutex
;
// 管理图像信息的互斥量
std
::
mutex
pointcloud_mutex
;
// 管理点云信息的互斥量
std
::
mutex
pointcloud_mutex
;
// 管理点云信息的互斥量
std
::
mutex
ts_mutex
;
// 管理时间戳的互斥量
std
::
mutex
ts_mutex
;
// 管理时间戳的互斥量
std
::
mutex
tf_mutex
;
// 管理时间戳的互斥量
int64_t
img_timestamp_sys_
=
0
;
//接收到图像消息的系统时间
int64_t
img_timestamp_sys_
=
0
;
//接收到图像消息的系统时间
int64_t
pc_timestamp_sys_
=
0
;
//接收到点云消息的系统时间
int64_t
pc_timestamp_sys_
=
0
;
//接收到点云消息的系统时间
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment