@@ -13,38 +13,30 @@ bool CustomCam::Initialization() {
1313void CustomCam::Stop () {
1414 Disable ();
1515 std::this_thread::sleep_for (std::chrono::milliseconds{500 });
16- for (auto &cam_thread : cam_threads_ ) {
16+ for (auto &cam_thread : cam_threads ) {
1717 while (cam_thread.joinable ()) {
1818 cam_thread.join ();
1919 }
2020 }
21- cam_threads_ .clear ();
22- cam_threads_ .shrink_to_fit ();
21+ cam_threads .clear ();
22+ cam_threads .shrink_to_fit ();
2323}
2424void CustomCam::Receive (void *handle, const std::string &name) {
25- while (is_running_) {
25+ Messenger &messenger = Messenger::GetInstance ();
26+ while (is_running) {
2627 CamData cam_data;
27- if (params_.find (name) == params_.end ()) {
28- LOG (ERROR) << " cam " << name << " not found!" ;
29- }
30- else {
31- if (uint64_t time; GET_LAST_TRIGGER_STATUS (params_[name], time)) {
28+ if (params.find (name) != params.end ()) {
29+ if (uint64_t time; GET_LAST_TRIGGER_STATUS (params[name], time)) {
3230 cam_data.time_stamp_us = time;
3331 }
34- else {
35- LOG (ERROR) << " cam " << name << " not found!" ;
36- }
3732 }
38-
39- cam_data.image = GMat (st_out_frame.stFrameInfo .nHeight , st_out_frame.stFrameInfo .nWidth ,
40- GMatType<uint8_t , 1 >::Type, st_out_frame.pBufAddr );
41-
33+ cam_data.image = GMat ();
4234 messenger.PubStruct (name,&cam_data,sizeof (cam_data));
43- std::this_thread::sleep_for (std::chrono::milliseconds{2 });
35+ std::this_thread::sleep_for (std::chrono::milliseconds{1 });
4436 }
4537}
4638void CustomCam::Start () {
4739 std::string name = " cus_camera" ;
48- cam_threads_ .emplace_back (&CustomCam::Receive, this , nullptr , name);
40+ cam_threads .emplace_back (&CustomCam::Receive, this , nullptr , name);
4941}
5042} // namespace infinite_sense
0 commit comments