|
|
@@ -136,7 +136,7 @@ iv::decition::BrainDecition::BrainDecition()
|
|
|
|
|
|
mpaVechicleState = iv::modulecomm::RegisterSend(gstrmembrainstate.data(),10000,10);
|
|
|
|
|
|
- mpfusion = iv::modulecomm::RegisterRecv("lidar_obs",ListenOBS);
|
|
|
+// mpfusion = iv::modulecomm::RegisterRecv("lidar_obs",ListenOBS);//20210929,cxw,buyong zhege
|
|
|
// mpfusion = iv::modulecomm::RegisterRecv("li_ra_fusion",ListenFusion);
|
|
|
|
|
|
|
|
|
@@ -343,21 +343,21 @@ void iv::decition::BrainDecition::run() {
|
|
|
ServiceCarStatus.txt_log_on=false;
|
|
|
}
|
|
|
|
|
|
- if(ServiceCarStatus.txt_log_on==true){
|
|
|
- QDateTime dt = QDateTime::currentDateTime();
|
|
|
- QString date =dt.toString("yyyy_MM_dd_hhmm");
|
|
|
- QString strsen = "datalog_";
|
|
|
- date.append(strsen);
|
|
|
- //将数据写入文件开始
|
|
|
- ofstream outfile;
|
|
|
- outfile.open("control_log.txt", ostream::ate);
|
|
|
- outfile.flush();
|
|
|
- outfile<<dt.date().year()<<"-"<<dt.date().month()<<"-"<<dt.date().day()<<" "<<dt.time().hour()<<":"<<dt.time().minute()<<":"<<dt.time().second()<<"-"<<dt.time().msec()<<'\t'
|
|
|
- <<"vehState"<<'\t'<<"PathPoint"<<'\t'<<setprecision(4)<<"dSpeed"<<'\t'<<"obsDistance"<<'\t'<<"obsSpeed"<<'\t'<<"realspeed"<<'\t'<<"minDecelerate"<<'\t'
|
|
|
- <<"torque"<<'\t'<<"brake"<<'\t'<<"wheel_angle"<<endl;
|
|
|
- outfile.close();
|
|
|
- //将数据写入文件结束
|
|
|
- }
|
|
|
+// if(ServiceCarStatus.txt_log_on==true){
|
|
|
+// QDateTime dt = QDateTime::currentDateTime();
|
|
|
+// QString date =dt.toString("yyyy_MM_dd_hhmm");
|
|
|
+// QString strsen = "datalog_";
|
|
|
+// date.append(strsen);
|
|
|
+// //将数据写入文件开始
|
|
|
+// ofstream outfile;
|
|
|
+// outfile.open("control_log.txt", ostream::ate);
|
|
|
+// outfile.flush();
|
|
|
+// outfile<<dt.date().year()<<"-"<<dt.date().month()<<"-"<<dt.date().day()<<" "<<dt.time().hour()<<":"<<dt.time().minute()<<":"<<dt.time().second()<<"-"<<dt.time().msec()<<'\t'
|
|
|
+// <<"vehState"<<'\t'<<"PathPoint"<<'\t'<<setprecision(4)<<"dSpeed"<<'\t'<<"obsDistance"<<'\t'<<"obsSpeed"<<'\t'<<"realspeed"<<'\t'<<"minDecelerate"<<'\t'
|
|
|
+// <<"torque"<<'\t'<<"brake"<<'\t'<<"wheel_angle"<<endl;
|
|
|
+// outfile.close();
|
|
|
+// //将数据写入文件结束
|
|
|
+// }
|
|
|
|
|
|
std::string strparklat = xp.GetParam("parklat","39.0624557");
|
|
|
std::string strparklng = xp.GetParam("parklng","117.3575493");
|
|
|
@@ -1428,11 +1428,11 @@ void iv::decition::BrainDecition::GetFusion(const char *pdata, const int ndatasi
|
|
|
}
|
|
|
void iv::decition::BrainDecition::UpdateOBS(std::shared_ptr<std::vector<iv::ObstacleBasic> > lidar_obs)
|
|
|
{
|
|
|
- std::shared_ptr<std::vector<iv::ObstacleBasic>> mobs;
|
|
|
- iv::LidarGridPtr ptr;
|
|
|
- mMutex_.lock();
|
|
|
- lidar_obs.swap(mobs);
|
|
|
- mMutex_.unlock();
|
|
|
+// std::shared_ptr<std::vector<iv::ObstacleBasic>> mobs;
|
|
|
+// iv::LidarGridPtr ptr;
|
|
|
+// mMutex_.lock();
|
|
|
+// lidar_obs.swap(mobs);
|
|
|
+// mMutex_.unlock();
|
|
|
|
|
|
// ptr = (Obs_grid *)malloc(sizeof(Obs_grid[iv::grx][iv::gry]));
|
|
|
// memset(ptr, 0, sizeof(Obs_grid[iv::grx][iv::gry]));
|
|
|
@@ -1483,41 +1483,41 @@ void iv::decition::BrainDecition::UpdateOBS(std::shared_ptr<std::vector<iv::Obst
|
|
|
|
|
|
|
|
|
|
|
|
- mMutex_.lock();
|
|
|
-// fusion_obs.swap(mfusion_obs_);
|
|
|
- if(fusion_ptr_ != NULL)
|
|
|
- {
|
|
|
- free(fusion_ptr_);
|
|
|
- fusion_ptr_ = NULL;
|
|
|
- }
|
|
|
- fusion_ptr_ = (Obs_grid *)malloc(sizeof(Obs_grid[iv::grx][iv::gry]));
|
|
|
- memset(fusion_ptr_,0,sizeof(Obs_grid[iv::grx][iv::gry]));
|
|
|
- for(int i =0; i<iv::grx; i++) //复制到指针数组
|
|
|
- {
|
|
|
- for(int j =0; j<iv::gry; j++)
|
|
|
- {
|
|
|
- fusion_ptr_[i*(iv::gry)+j].ob = 0;
|
|
|
- }
|
|
|
+// mMutex_.lock();
|
|
|
+//// fusion_obs.swap(mfusion_obs_);
|
|
|
+// if(fusion_ptr_ != NULL)
|
|
|
+// {
|
|
|
+// free(fusion_ptr_);
|
|
|
+// fusion_ptr_ = NULL;
|
|
|
+// }
|
|
|
+// fusion_ptr_ = (Obs_grid *)malloc(sizeof(Obs_grid[iv::grx][iv::gry]));
|
|
|
+// memset(fusion_ptr_,0,sizeof(Obs_grid[iv::grx][iv::gry]));
|
|
|
+// for(int i =0; i<iv::grx; i++) //复制到指针数组
|
|
|
+// {
|
|
|
+// for(int j =0; j<iv::gry; j++)
|
|
|
+// {
|
|
|
+// fusion_ptr_[i*(iv::gry)+j].ob = 0;
|
|
|
+// }
|
|
|
|
|
|
- }
|
|
|
+// }
|
|
|
|
|
|
- for(int i=0;i<mobs->size();i++)
|
|
|
- {
|
|
|
- iv::ObstacleBasic xobs = mobs->at(i);
|
|
|
- int dx,dy;
|
|
|
- dx = (xobs.nomal_x + gridwide * (double)centerx)/gridwide;
|
|
|
- dy = (xobs.nomal_y + gridwide * (double)centery)/gridwide;
|
|
|
- if((dx>=0)&&(dx<iv::grx)&&(dy>=0)&&(dy<iv::gry))
|
|
|
- {
|
|
|
- fusion_ptr_[dx*(iv::gry) +dy].high = xobs.high;
|
|
|
- fusion_ptr_[dx*(iv::gry) +dy].low = xobs.low;
|
|
|
- fusion_ptr_[dx*(iv::gry) + dy].ob = 2;
|
|
|
- fusion_ptr_[dx*(iv::gry) + dy].obshight = xobs.nomal_z;
|
|
|
- fusion_ptr_[dx*(iv::gry) + dy].pointcount = 5;
|
|
|
- }
|
|
|
+// for(int i=0;i<mobs->size();i++)
|
|
|
+// {
|
|
|
+// iv::ObstacleBasic xobs = mobs->at(i);
|
|
|
+// int dx,dy;
|
|
|
+// dx = (xobs.nomal_x + gridwide * (double)centerx)/gridwide;
|
|
|
+// dy = (xobs.nomal_y + gridwide * (double)centery)/gridwide;
|
|
|
+// if((dx>=0)&&(dx<iv::grx)&&(dy>=0)&&(dy<iv::gry))
|
|
|
+// {
|
|
|
+// fusion_ptr_[dx*(iv::gry) +dy].high = xobs.high;
|
|
|
+// fusion_ptr_[dx*(iv::gry) +dy].low = xobs.low;
|
|
|
+// fusion_ptr_[dx*(iv::gry) + dy].ob = 2;
|
|
|
+// fusion_ptr_[dx*(iv::gry) + dy].obshight = xobs.nomal_z;
|
|
|
+// fusion_ptr_[dx*(iv::gry) + dy].pointcount = 5;
|
|
|
+// }
|
|
|
|
|
|
- }
|
|
|
- mMutex_.unlock();
|
|
|
+// }
|
|
|
+// mMutex_.unlock();
|
|
|
}
|
|
|
|
|
|
void iv::decition::BrainDecition::UpdateFusion(std::shared_ptr<iv::fusion::fusionobjectarray> fusion_obs)
|