CameraMyntEye: added setIrControl()

This commit is contained in:
matlabbe
2020-05-31 12:17:14 -04:00
parent 415a2778f1
commit d5cfd8013d
4 changed files with 73 additions and 16 deletions

View File

@@ -61,7 +61,9 @@ public:
virtual bool odomProvided() const { return false; }
void publishInterIMU(bool enabled);
void setAutoExposure(bool enabled, int manualGain=24, int manualBrightness=120, int manualConstrast=116);
void setAutoExposure();
void setManualExposure(int gain=24, int brightness=120, int constrast=116);
void setIrControl(int value);
protected:
/**
@@ -85,6 +87,7 @@ private:
int gain_;
int brightness_;
int contrast_;
int irControl_;
USemaphore dataReady_;
UMutex dataMutex_;
cv::Mat leftFrameBuffer_;

View File

@@ -154,13 +154,31 @@ void CameraMyntEye::publishInterIMU(bool enabled)
#endif
}
void CameraMyntEye::setAutoExposure(bool enabled, int manualGain, int manualBrightness, int manualConstrast)
void CameraMyntEye::setAutoExposure()
{
#ifdef RTABMAP_MYNTEYE
autoExposure_ = enabled;
gain_ = manualGain;
brightness_ = manualBrightness;
contrast_ = manualConstrast;
autoExposure_ = true;
#endif
}
void CameraMyntEye::setManualExposure(int gain, int brightness, int constrast)
{
#ifdef RTABMAP_MYNTEYE
UASSERT(gain>=0 && gain<=48);
UASSERT(brightness>=0 && brightness<=240);
UASSERT(constrast>=0 && constrast<=254);
autoExposure_ = false;
gain_ = gain;
brightness_ = brightness;
contrast_ = constrast;
#endif
}
void CameraMyntEye::setIrControl(int value)
{
#ifdef RTABMAP_MYNTEYE
UASSERT(value>=0 && value<=160);
irControl_ = value;
#endif
}
@@ -451,6 +469,7 @@ bool CameraMyntEye::init(const std::string & calibrationFolder, const std::strin
api_->SetOptionValue(mynteye::Option::BRIGHTNESS, brightness_);
api_->SetOptionValue(mynteye::Option::CONTRAST, contrast_);
}
api_->SetOptionValue(mynteye::Option::IR_CONTROL, irControl_);
api_->Start(mynteye::Source::ALL);
uSleep(500); // To buffer some imus before sending images