-
Notifications
You must be signed in to change notification settings - Fork 5
Mobile Platform Data Storing
πΎcam, lidar, gps, imu, can λ€μ―κ°μ§ μΌμ λ°μ΄ν° λͺ¨λ csv νμΌλ‘ μ μ₯λλ€.
MobilePlatform/Sensing/~SensingThread.cpp
// <make csv file>
string path = "csv fileμ΄ μ μ₯λ μμΉμ μ μ₯νκ³ μΆμ csv file μ΄λ¦";
fstream dataFile;
dataFile.open(path, ios::out);
string path = " "μ csv fileμ΄ μ μ₯λ μμΉμ μ μ₯νκ³ μΆμ csv file μ΄λ¦μ μ μ΄μ€λ€.
1. ν΄λ μμ±
MobilePlatform/Sensing/main.cpp
ββ diva2
β ββ DIVA2_DATA
β β ββ YYYYMDD_0
β β ββ GPS
β β ββ IMU
β β ββ CAN
β β ββ CAM
β β β ββ JPG
β β ββ LiDAR
β β ββ PCD
mainλ¬Έμμ /home/diva2 κ²½λ‘ μμ
μμ κ°μ΄ DIVA2_DATA/YYYYMDD_0 ν΄λκ° μμ±λλ©°,
κ·Έ ν΄λ μμ GPS, IMU, CAN, CAM, LiDAR ν΄λκ° μμ±λλ€.
CAM/JPG, LiDAR/PCD ν΄λλ ν¨κ» μμ±λλ€.
time_t system_time;
struct tm* systime;
system_time = time(NULL);
systime = localtime(&system_time);
string tm_year = to_string(systime->tm_year + 1900);
string tm_month = to_string(systime->tm_mon+1);
string tm_date = to_string(systime->tm_mday);
if(tm_date.size() == 1){
tm_date = "0"+tm_date;
}
string timestamp;
timestamp = tm_year + tm_month + tm_date;
string command = "mkdir -p /home/diva2/DIVA2_DATA/"+timestamp+"_0/CAM/JPG"+ " /home/diva2/DIVA2_DATA/"+timestamp+"_0/LiDAR/PCD" + " /home/diva2/DIVA2_DATA/"+timestamp+"_0/GPS" + " /home/diva2/DIVA2_DATA/"+timestamp+"_0/IMU" + " /home/diva2/DIVA2_DATA/"+timestamp+"_0/CAN";
const char *c = command.c_str();
system(c);
cout<<"makedirectory"<<endl;
2. κ°κ°μ μΌμ threadμμ λ°μ΄ν° μ μ₯
μμ : GpsSensingThread.cpp
λ€μ―κ°μ§ μΌμ λ°μ΄ν°λ μ΄μ κ°μ λ°©μμΌλ‘ csv νμμΌλ‘ μ μ₯λλ€.
// <make csv file>
string path = "csv fileμ΄ μ μ₯λ μμΉμ μ μ₯νκ³ μΆμ csv file μ΄λ¦";
fstream dataFile;
dataFile.open(path, ios::out);
μ ν΄μ€ νμΌλͺ μΌλ‘ csv νμΌμ΄ μμ±λλ€.
while (1)
{
...
...
...
char cSn[50];
//timestamp
auto time = chrono::system_clock::now();
auto mill = chrono::duration_cast<chrono::milliseconds>(time.time_since_epoch());
long long currentTimeMillis = mill.count();
int msc = currentTimeMillis % 1000;
long nowTime = currentTimeMillis / 1000;
tm *ts = localtime(&nowTime);
sprintf(cSn, "%04d%02d%02d%02d%02d%02d%03d",
ts->tm_year + 1900, ts->tm_mon + 1, ts->tm_mday, ts->tm_hour, ts->tm_min, ts->tm_sec, msc);
// <save csv file>
cout << cSn << endl;
dataFile << cSn << "," << strBuff[2] << "," << strBuff[4] << "," << strBuff[8] << std::endl;
}
}
// <close csv file>
dataFile.close();
csv νμΌ μμ sensingν λ°μ΄ν°λ€μ μ μ₯νλ€. lidarμ camμ csv νμΌμλ timestampλ§ μ μ₯νκ³ , μλ³Έ μ¬μ§κ³Ό pcd νμΌμ λ°λ‘ JPG, PCD ν΄λ μμ μ μ₯νλ€.
gps - timestamp, latitude(μλ), longitude(κ²½λ), horixontaldilutionofprecision(μνμμΉμ€μ°¨)
imu - timestamp, scaledaccelx(xμΆ acceleration), scaledaccely(yμΆ acceleration), scaleaccelz(zμΆ acceleration)
can - timestamp, handle_angle(νΈλ€ κ°λ), turnlight(λ°©ν₯ μ§μλ±), vehiclespeed(νμ μλκ³), gear(κΈ°μ΄ λͺ¨λ)
cam - timestamp
lidar - timestamp
camκ³Ό lidarλ μ·¨λν μλ³Έ νμΌλ€μ΄ ν¨κ» μ μ₯λλ€.
camμ DIVA2_DATA/YYYYMDD_0/CAM/JPG ν΄λ μμ CAM_timestamp.jpg νμΌλͺ
μΌλ‘, lidarλ DIVA2_DATA/YYYYMDD_0/LiDAR/PCD ν΄λ μμ LiDAR_timestamp.pcd νμΌλͺ
μΌλ‘ μ μ₯λλ€.
If you have any questions, please email below.
- dazory: [email protected]
- yuntreee: [email protected]
- airpod2: [email protected]
- ka-yeon: [email protected]
-
π Mobile Platform
-
π Ground Station