Changeset 98 in pacpussensors
- Timestamp:
- Oct 8, 2015, 10:29:42 PM (9 years ago)
- Location:
- trunk/Ladybug
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ladybug/LadybugComponent.cpp
r81 r98 32 32 // Construct the factory 33 33 static ComponentFactory<LadybugComponent> sFactory("LadybugComponent"); 34 static const size_t kMaxFilepathLength = 128; 34 35 35 36 /* *Constructor*/ … … 56 57 lbTotalNumberOfImagesWritten = 0; 57 58 lbNumOfFrames = 0; 59 60 if (lbSaveJPGImages) 61 { 62 try 63 { 64 QString dbtFileName_ = "Camera_1.dbt"; 65 mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength); 66 } catch (DbiteException & e) { 67 LOG_ERROR("error opening dbt file: " << e.what()); 68 } 69 70 try 71 { 72 QString dbtFileName_ = "Camera_2.dbt"; 73 mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength); 74 } catch (DbiteException & e) { 75 LOG_ERROR("error opening dbt file: " << e.what()); 76 } 77 78 try 79 { 80 QString dbtFileName_ = "Camera_3.dbt"; 81 mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength); 82 } catch (DbiteException & e) { 83 LOG_ERROR("error opening dbt file: " << e.what()); 84 } 85 86 try 87 { 88 QString dbtFileName_ = "Camera_4.dbt"; 89 mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength); 90 } catch (DbiteException & e) { 91 LOG_ERROR("error opening dbt file: " << e.what()); 92 } 93 94 try 95 { 96 QString dbtFileName_ = "Camera_5.dbt"; 97 mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength); 98 } catch (DbiteException & e) { 99 LOG_ERROR("error opening dbt file: " << e.what()); 100 } 101 102 try 103 { 104 QString dbtFileName_ = "Camera_6.dbt"; 105 mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength); 106 } catch (DbiteException & e) { 107 LOG_ERROR("error opening dbt file: " << e.what()); 108 } 109 } 110 111 if (lbSavePanoImage) 112 { 113 try 114 { 115 QString dbtFileName_ = "CameraPano.dbt"; 116 mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength); 117 } catch (DbiteException & e) { 118 LOG_ERROR("error opening dbt file: " << e.what()); 119 } 120 } 121 58 122 THREAD_ALIVE = true; 59 123 start(); … … 66 130 printf (" \n*** Stopping Activity ***\n"); 67 131 LadybugError error; 132 133 // Close DBT files 134 if (lbSaveJPGImages) { 135 mDbtImage1.close(); 136 mDbtImage2.close(); 137 mDbtImage3.close(); 138 mDbtImage4.close(); 139 mDbtImage5.close(); 140 mDbtImage6.close(); 141 } 142 143 if (lbSavePanoImage) { 144 mDbtImagePano.close(); 145 } 68 146 69 147 lbIsRecording = false; … … 144 222 CreateImageBuffers(); 145 223 224 // Timestamp 225 road_time_t timestamp = 0; 226 road_timerange_t tr = 0; 227 146 228 while (THREAD_ALIVE) 147 229 { 230 148 231 lbCurrentTime = GetTickCount(); // road_time_t timestamp = road_time(); // ui64 ; unit microsec ; Orig 01/01/1970 00:00 149 232 lbFrameCount++; … … 158 241 159 242 error = ladybugGrabImage( lbContext, &image ); 160 // t= road_time(); // timestamp243 timestamp = road_time(); // timestamp 161 244 HandleError(error); 162 245 … … 245 328 HandleError(error); 246 329 330 331 // Use it to trigger the camera with the gps signal 247 332 /*// Initialize Trigger 248 333 error = ladybugGetTriggerModeInfo( lbContext, &triggerModeInfo ); … … 356 441 HandleError(error); 357 442 443 if (uiCamera == 0) 444 { 445 try { 446 mDbtImage1.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength); 447 } catch (DbiteException & e) { 448 LOG_ERROR("error writing data: " << e.what()); 449 } 450 } else if (uiCamera == 1) { 451 try { 452 mDbtImage2.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength); 453 } catch (DbiteException & e) { 454 LOG_ERROR("error writing data: " << e.what()); 455 } 456 }else if (uiCamera == 2) { 457 try { 458 mDbtImage3.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength); 459 } catch (DbiteException & e) { 460 LOG_ERROR("error writing data: " << e.what()); 461 } 462 }else if (uiCamera == 3) { 463 try { 464 mDbtImage4.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength); 465 } catch (DbiteException & e) { 466 LOG_ERROR("error writing data: " << e.what()); 467 } 468 }else if (uiCamera == 4) { 469 try { 470 mDbtImage5.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength); 471 } catch (DbiteException & e) { 472 LOG_ERROR("error writing data: " << e.what()); 473 } 474 }else if (uiCamera == 5) { 475 try { 476 mDbtImage6.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength); 477 } catch (DbiteException & e) { 478 LOG_ERROR("error writing data: " << e.what()); 479 } 480 } 481 358 482 //printf("Saved camera %u image to %s.\n", uiCamera, pszOutputFilePath); 359 483 … … 401 525 error = ladybugSaveImage(lbContext, &processedImage, pszOutputFilePath, LADYBUG_FILEFORMAT_JPG); 402 526 HandleError(error); 527 528 try { 529 mDbtImagePano.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength); 530 } catch (DbiteException & e) { 531 LOG_ERROR("error writing data: " << e.what()); 532 } 403 533 404 534 } -
trunk/Ladybug/LadybugComponent.h
r81 r98 4 4 //#include "Pacpus/kernel/pacpus.h" 5 5 #include "Pacpus/kernel/ComponentBase.h" 6 //#include "Pacpus/kernel/DbiteFile.h"6 #include "Pacpus/kernel/DbiteFile.h" 7 7 //#include "../NMEA0183/include/nmea0183.h" 8 8 … … 121 121 int lbNumOfFrames; 122 122 123 DbiteFile mDbtImage1; 124 DbiteFile mDbtImage2; 125 DbiteFile mDbtImage3; 126 DbiteFile mDbtImage4; 127 DbiteFile mDbtImage5; 128 DbiteFile mDbtImage6; 129 DbiteFile mDbtImagePano; 130 123 131 }; 124 132 }
Note:
See TracChangeset
for help on using the changeset viewer.