Skip to content

Commit c48541b

Browse files
author
wangchuang03
committed
fix: aem and lidar driver bugfix
- cyber: - 24dc9440e8 fix(aem): fix aem-enter and gtsam,openss install - docs: - 15727616bc fix(docs): add calibration document supplement - drivers: - 355937ba82 fix(lidar): fix lslidar driver - 4e675ff980 Commit code for CXZL gnss module (#15558) Signed-off-by: wangchuang03 <[email protected]> Change-Id: Ic922257c66adc045259853ba13c104cca4054f72
1 parent 2c20d75 commit c48541b

File tree

9 files changed

+109
-106
lines changed

9 files changed

+109
-106
lines changed

aem/aem-bootstrap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,15 @@ Options:
4545

4646
start() {
4747
local use_origin_dv=0
48+
local log_subfix=""
4849
if [[ -z "${APOLLO_DISTRIBUTION_VERSION}" ]]; then
4950
warn "APOLLO_DISTRIBUTION_VERSION is not set. fallback to 8.0"
5051
buildtool bootstrap start dreamview-dev
5152
buildtool bootstrap start monitor-dev
5253
else
5354
case "$1" in
5455
--plus)
56+
log_subfix="_plus"
5557
buildtool bootstrap start dreamview_plus
5658
buildtool bootstrap start monitor
5759
;;
@@ -75,7 +77,7 @@ start() {
7577
if [[ "${http_status}" == 200 ]]; then
7678
info "dreamview is started at ${dv_full_url}"
7779
else
78-
error "failed to start dreamview, please check the logs ( ${APOLLO_ENV_ROOT}/opt/apollo/neo/data/log/dreamview.log or ${APOLLO_ENV_ROOT}/opt/apollo/neo/data/log/monitor.log ) for more details."
80+
error "failed to start dreamview, please check the logs ( data/log/dreamview${log_subfix}.INFO or data/log/monitor.INFO ) for more details."
7981
fi
8082
}
8183

aem/aem-enter

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ execute() {
5959

6060
parse_arguments "$@"
6161

62+
# compatible for versions before 10.0
63+
export APOLLO_ENV_CONTAINER_NAME="${APOLLO_ENV_CONTAINER_PREFIX}${APOLLO_ENV_NAME}"
64+
6265
[[ -f "${APOLLO_ENVS_ROOT}/${APOLLO_ENV_NAME}/env.config" ]] && set -a && source "${APOLLO_ENVS_ROOT}/${APOLLO_ENV_NAME}/env.config" && set +a
6366

6467
apollo_enter_env

aem/ansible/roles/legacy_scripts/files/installers/install_gtsam.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ PATCHES=(
4141
)
4242

4343
src_prepare_pre() {
44-
# apt_get_update_and_install libboost-all-dev
44+
apt_get_update_and_install libboost-all-dev
4545
apt_get_update_and_install apollo-neo-3rd-boost
4646
# TODO: pack to 3rd-boost release tarball
4747
boost_cmake_files_url='https://apollo-system.cdn.bcebos.com/archive/10.0/3rd-boost_1.74.0_cmake_files.tar.gz'

aem/ansible/roles/legacy_scripts/files/installers/install_openssl.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ src_configure() {
4545
popd
4646
}
4747

48+
pkg_install() {
49+
:
50+
}
51+
4852
pkg_install_post() {
4953
if [[ -d "${INSTALL_PREFIX}/lib64" ]] && [[ ! -e "${INSTALL_PREFIX}/lib" ]]; then
5054
ln -snf lib64 "${INSTALL_PREFIX}/lib"

aem/env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ else
2323
export AEM_HOME=${AEM_HOME:-$(dirname $(realpath $0))}
2424
fi
2525
export AEM_SYS_SHARE=${AEM_SYS_SHARE:-${AEM_HOME}/share/aem}
26-
export AEM_VERSION='10.0.0-rc1-r3'
26+
export AEM_VERSION='10.0.0-rc1-r4'
2727

2828
export APOLLO_ENVS_ROOT=${APOLLO_ENVS_ROOT:-${HOME}/.aem/envs}
2929
export APOLLO_ENV_NAME="${USER}"

docs/工具使用/标定工具/动力学标定.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010

1111
## 模块启动依赖
1212

13-
标定工具依赖定位 Localization、GPS 以及 Caubus 模块,标定前请您确保相关模块启动正常。
14-
13+
标定工具依赖定位 Localization、GPS 以及 Caubus 模块,标定前请您确保相关模块启动正常。因为动力学标定依赖tensorflow,请执行以下命令安装tensorflow环境。
14+
```bash
15+
pip3 show tensorflow >/dev/null || pip3 install tensorflow==2.11.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
16+
```
1517
## 操作步骤
1618

1719
### 步骤一:参数确认

docs/工具使用/标定工具/环境配置.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ camera_calib { # camera标定配置
7777
lidar_rotation: 0 # lidar点云旋转角度,默认是0度,逆时针为正
7878
intrinsics_filename: "/apollo/modules/perception/data/params/camera_front_12mm_intrinsics.yaml" # 内参文件路径
7979
output_filename: "/apollo/modules/perception/data/params/camera_front_12mm_extrinsics.yaml" # 标定结果文件路径(文件要存在并有写入权限)
80+
lidar_to_imu_extrinsic_file_path: "/apollo/modules/perception/data/params/lidar16_back_imu_extrinsics.yaml" #lidar-imu外参路径
8081
},
8182
{
8283
name: "camera_front_6mm" # camera名字,前端展示用
@@ -87,6 +88,7 @@ camera_calib { # camera标定配置
8788
lidar_rotation: 0 # lidar点云旋转角度,默认是0度,逆时针为正
8889
intrinsics_filename: "/apollo/modules/perception/data/params/camera_front_6mm_intrinsics.yaml" # 内参文件路径
8990
output_filename: "/apollo/modules/perception/data/params/camera_front_6mm_extrinsics.yaml" # 标定结果文件路径(文件要存在并有写入权限)
91+
lidar_to_imu_extrinsic_file_path: "/apollo/modules/perception/data/params/lidar16_back_imu_extrinsics.yaml" #lidar-imu外参路径
9092
}
9193
]
9294
}

modules/drivers/lidar/common/sync_queue.h

Lines changed: 34 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -65,58 +65,46 @@ namespace drivers {
6565
template <typename T>
6666
class SyncQueue {
6767
public:
68-
inline size_t push(const T& value) {
69-
bool empty = false;
70-
size_t size = 0;
71-
72-
{
73-
std::lock_guard<std::mutex> lg(mtx_);
74-
empty = queue_.empty();
75-
queue_.push(value);
76-
size = queue_.size();
77-
}
78-
79-
if (empty)
80-
cv_.notify_one();
81-
return size;
68+
inline size_t push(const T& value) {
69+
std::lock_guard<std::mutex> lg(mtx_);
70+
queue_.push(value);
71+
return queue_.size();
72+
}
73+
74+
inline T pop() {
75+
T value;
76+
77+
std::lock_guard<std::mutex> lg(mtx_);
78+
if (!queue_.empty()) {
79+
value = queue_.front();
80+
queue_.pop();
8281
}
8382

84-
inline T pop() {
85-
T value;
86-
87-
std::lock_guard<std::mutex> lg(mtx_);
88-
if (!queue_.empty()) {
89-
value = queue_.front();
90-
queue_.pop();
91-
}
92-
93-
return value;
83+
return value;
84+
}
85+
86+
inline bool popWait(T& ret_ele, unsigned int usec = 1000000) {
87+
{
88+
std::lock_guard<std::mutex> lg(mtx_);
89+
if (!queue_.empty()) {
90+
ret_ele = queue_.front();
91+
queue_.pop();
92+
return true;
93+
}
9494
}
95+
std::this_thread::sleep_for(std::chrono::microseconds(usec));
96+
return false;
97+
}
9598

96-
inline bool popWait(T& ret_ele, unsigned int usec = 1000000) {
97-
{
98-
std::lock_guard<std::mutex> lg(mtx_);
99-
if (!queue_.empty()) {
100-
ret_ele = queue_.front();
101-
queue_.pop();
102-
return true;
103-
}
104-
}
105-
106-
std::this_thread::sleep_for(std::chrono::microseconds(1000));
107-
return false;
108-
}
109-
110-
inline void clear() {
111-
std::queue<T> empty;
112-
std::lock_guard<std::mutex> lg(mtx_);
113-
swap(empty, queue_);
114-
}
99+
inline void clear() {
100+
std::queue<T> empty;
101+
std::lock_guard<std::mutex> lg(mtx_);
102+
swap(empty, queue_);
103+
}
115104

116105
private:
117-
std::queue<T> queue_;
118-
std::mutex mtx_;
119-
std::condition_variable cv_;
106+
std::queue<T> queue_;
107+
std::mutex mtx_;
120108
};
121109

122110
} // namespace drivers

modules/drivers/lidar/lslidar/component/lslidar_component.cpp

Lines changed: 57 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -21,84 +21,86 @@ namespace drivers {
2121
namespace lslidar {
2222

2323
LslidarComponent::~LslidarComponent() {
24-
if (device_thread_->joinable()) {
25-
device_thread_->join();
26-
}
27-
if (pointcloud_convert_thread_->joinable()) {
28-
pointcloud_convert_thread_->join();
29-
}
24+
if (device_thread_->joinable()) {
25+
device_thread_->join();
26+
}
27+
if (pointcloud_convert_thread_->joinable()) {
28+
pointcloud_convert_thread_->join();
29+
}
3030
}
3131

3232
bool LslidarComponent::Init() {
33-
if (!GetProtoConfig(&conf_)) {
34-
AERROR << "load config error, file:" << config_file_path_;
35-
return false;
36-
}
33+
if (!GetProtoConfig(&conf_)) {
34+
AERROR << "load config error, file:" << config_file_path_;
35+
return false;
36+
}
3737

38-
this->InitBase(conf_.config_base());
38+
this->InitBase(conf_.config_base());
3939

40-
driver::LslidarDriver *driver
41-
= driver::LslidarDriverFactory::CreateDriver(conf_);
42-
if (!driver) {
43-
return false;
44-
}
45-
dvr_.reset(driver);
46-
dvr_->Init();
47-
// spawn device poll thread
48-
// runing_ = true;
49-
device_thread_ = std::shared_ptr<std::thread>(new std::thread(
50-
std::bind(&LslidarComponent::DevicePollProcess, this)));
51-
pointcloud_convert_thread_ = std::make_shared<std::thread>(
52-
&LslidarComponent::ScanQueuePollProcess, this);
40+
driver::LslidarDriver *driver =
41+
driver::LslidarDriverFactory::CreateDriver(conf_);
42+
if (!driver) {
43+
return false;
44+
}
45+
dvr_.reset(driver);
46+
dvr_->Init();
47+
// spawn device poll thread
48+
// runing_ = true;
49+
device_thread_ = std::shared_ptr<std::thread>(
50+
new std::thread(std::bind(&LslidarComponent::DevicePollProcess, this)));
51+
pointcloud_convert_thread_ = std::make_shared<std::thread>(
52+
&LslidarComponent::ScanQueuePollProcess, this);
5353

54-
converter_ = std::make_shared<parser::Convert>();
55-
converter_->init(conf_);
54+
converter_ = std::make_shared<parser::Convert>();
55+
converter_->init(conf_);
5656

57-
return true;
57+
return true;
5858
}
5959

6060
void LslidarComponent::ReadScanCallback(
61-
const std::shared_ptr<LslidarScan> &scan_message) {
62-
HandleScanFrame(scan_message);
61+
const std::shared_ptr<LslidarScan> &scan_message) {
62+
HandleScanFrame(scan_message);
6363
}
6464

6565
void LslidarComponent::DevicePollProcess() {
66-
while (!apollo::cyber::IsShutdown()) {
67-
// poll device until end of file
68-
std::shared_ptr<LslidarScan> scan
69-
= std::make_shared<apollo::drivers::lslidar::LslidarScan>();
66+
while (!apollo::cyber::IsShutdown()) {
67+
// poll device until end of file
68+
std::shared_ptr<LslidarScan> scan =
69+
std::make_shared<apollo::drivers::lslidar::LslidarScan>();
7070

71-
bool ret = dvr_->Poll(scan);
72-
if (ret) {
73-
common::util::FillHeader("lslidar", scan.get());
74-
AINFO << "publish scan!";
75-
double time1 = apollo::cyber::Time().Now().ToSecond();
76-
this->WriteScan(scan);
77-
double time2 = apollo::cyber::Time().Now().ToSecond();
78-
AINFO << "apollo::cyber::Time((time2 - time1)"
79-
<< apollo::cyber::Time((time2 - time1) / 2.0).ToNanosecond();
80-
scan_queue_.push(scan);
81-
} else {
82-
AWARN << "device poll failed";
83-
}
71+
bool ret = dvr_->Poll(scan);
72+
if (ret) {
73+
common::util::FillHeader("lslidar", scan.get());
74+
AINFO << "publish scan!";
75+
double time1 = apollo::cyber::Time().Now().ToSecond();
76+
this->WriteScan(scan);
77+
double time2 = apollo::cyber::Time().Now().ToSecond();
78+
AINFO << "apollo::cyber::Time((time2 - time1)"
79+
<< apollo::cyber::Time((time2 - time1) / 2.0).ToNanosecond();
80+
scan_queue_.push(scan);
81+
} else {
82+
AWARN << "device poll failed";
8483
}
84+
}
8585

86-
AERROR << "CompLslidarDriver thread exit";
86+
AERROR << "CompLslidarDriver thread exit";
8787
}
8888

8989
void LslidarComponent::ScanQueuePollProcess() {
90-
std::shared_ptr<LslidarScan> scan_frame;
91-
while (!apollo::cyber::IsShutdown() && scan_queue_.popWait(scan_frame)) {
92-
HandleScanFrame(scan_frame);
90+
std::shared_ptr<LslidarScan> scan_frame;
91+
while (!apollo::cyber::IsShutdown()) {
92+
if (scan_queue_.popWait(scan_frame)) {
93+
HandleScanFrame(scan_frame);
9394
}
95+
}
9496
}
9597

9698
void LslidarComponent::HandleScanFrame(
97-
const std::shared_ptr<LslidarScan> &scan_frame) {
98-
std::shared_ptr<apollo::drivers::PointCloud> point_cloud_out
99-
= this->AllocatePointCloud();
100-
converter_->ConvertPacketsToPointcloud(scan_frame, point_cloud_out);
101-
this->WritePointCloud(point_cloud_out);
99+
const std::shared_ptr<LslidarScan> &scan_frame) {
100+
std::shared_ptr<apollo::drivers::PointCloud> point_cloud_out =
101+
this->AllocatePointCloud();
102+
converter_->ConvertPacketsToPointcloud(scan_frame, point_cloud_out);
103+
this->WritePointCloud(point_cloud_out);
102104
}
103105

104106
} // namespace lslidar

0 commit comments

Comments
 (0)