Changeset 150 in flair-src for trunk/lib/FlairSensorActuator/src


Ignore:
Timestamp:
Mar 1, 2017, 2:37:00 PM (8 years ago)
Author:
Bayard Gildas
Message:

SimuCamera thread is now working at simulated camera frequency

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairSensorActuator/src/SimuCamera.cpp

    r144 r150  
    3737    : Thread(getFrameworkManager(), name, priority),
    3838      Camera(name, width, height, cvimage::Type::Format::BGR) {
    39   data_rate =
    40       new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 200, 1, 50);
     39//  data_rate =
     40//      new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 200, 1, 50);
    4141
    4242  buf_size = width * height * channels;
     
    4747  ostringstream dev_name;
    4848  dev_name << "simu_cam_" << dev_id;
    49   shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), buf_size);
     49  shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), buf_size, SharedMem::Type::producerConsumer);
    5050}
    5151
     
    5353                       uint16_t height, uint8_t channels, uint32_t dev_id)
    5454    : Thread(parent, name, 0), Camera(parent,name) {
    55   data_rate = NULL;
     55//  data_rate = NULL;
    5656
    5757  ostringstream dev_name;
    5858  dev_name << "simu_cam_" << dev_id;
    5959  shmem = new SharedMem((Thread *)this, dev_name.str().c_str(),
    60                         width * height * channels);
     60                        width * height * channels, SharedMem::Type::producerConsumer);
    6161}
    6262
     
    6767
    6868void SimuCamera::Run(void) {
    69   if (data_rate == NULL) {
    70     Thread::Err("not applicable for simulation part.\n");
    71     return;
    72   }
     69//  if (data_rate == NULL) {
     70//    Thread::Err("not applicable for simulation part.\n");
     71//    return;
     72//  }
    7373
    74   SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
     74//  SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
     75  shmem->ReaderReady();
    7576
    7677  while (!ToBeStopped()) {
    77     WaitPeriod();
     78//    WaitPeriod();
    7879
    79     if (data_rate->ValueChanged() == true) {
    80       SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
    81     }
     80//    if (data_rate->ValueChanged() == true) {
     81//      SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
     82//    }
    8283
    8384    output->GetMutex();
Note: See TracChangeset for help on using the changeset viewer.