Update option_supports_map

This commit is contained in:
Kalman 2018-09-29 16:36:14 +08:00
parent 59370e3e8d
commit 33e38bba2f
4 changed files with 14 additions and 34 deletions

View File

@ -143,32 +143,27 @@ void Channels::LogControlInfos() const {
}
void Channels::UpdateControlInfos() {
/*
for (auto &&option : std::vector<Option>{Option::GAIN, Option::BRIGHTNESS,
Option::CONTRAST}) {
control_infos_[option] = PuControlInfo(option);
for (auto &&option : std::vector<Option>{Option::BRIGHTNESS}) {
control_infos_[option] = PuControlInfo(option);
}
for (auto &&option : std::vector<Option>{
Option::FRAME_RATE, Option::IMU_FREQUENCY, Option::EXPOSURE_MODE,
Option::EXPOSURE_MODE, Option::DESIRED_BRIGHTNESS,
Option::MAX_GAIN, Option::MAX_EXPOSURE_TIME,
Option::DESIRED_BRIGHTNESS, Option::IR_CONTROL, Option::HDR_MODE
Option::MIN_EXPOSURE_TIME, Option::ACCELEROMETER_RANGE,
Option::GYROSCOPE_RANGE, Option::ACCELEROMETER_LOW_PASS_FILTER,
Option::GYROSCOPE_LOW_PASS_FILTER})
{
control_infos_[option] = XuControlInfo(option);
Option::GYROSCOPE_LOW_PASS_FILTER}) {
control_infos_[option] = XuControlInfo(option);
}
if (VLOG_IS_ON(2)) {
for (auto &&it = control_infos_.begin(); it != control_infos_.end(); it++)
{
for (auto &&it = control_infos_.begin(); it != control_infos_.end();
it++) {
VLOG(2) << it->first << ": min=" << it->second.min
<< ", max=" << it->second.max << ", def=" << it->second.def
<< ", cur=" << GetControlValue(it->first);
}
}
*/
}
Channels::control_info_t Channels::GetControlInfo(const Option &option) const {

View File

@ -23,9 +23,11 @@ const std::map<Model, CapabilitiesSupports> capabilities_supports_map = {
const std::map<Model, OptionSupports> option_supports_map = {
{Model::STANDARD,
{Option::BRIGHTNESS, Option::EXPOSURE_MODE, Option::ERASE_CHIP,
Option::MIN_EXPOSURE_TIME, Option::ACCELEROMETER_RANGE,
Option::GYROSCOPE_RANGE, Option::ACCELEROMETER_LOW_PASS_FILTER,
{Option::BRIGHTNESS, Option::EXPOSURE_MODE, Option::MAX_GAIN,
Option::MAX_EXPOSURE_TIME, Option::DESIRED_BRIGHTNESS,
Option::MIN_EXPOSURE_TIME, Option::ERASE_CHIP,
Option::ACCELEROMETER_RANGE, Option::GYROSCOPE_RANGE,
Option::ACCELEROMETER_LOW_PASS_FILTER,
Option::GYROSCOPE_LOW_PASS_FILTER}}};
const std::map<Model, std::map<Capabilities, StreamRequests>>

View File

@ -35,8 +35,8 @@ Motions::~Motions() {
void Motions::SetMotionCallback(motion_callback_t callback) {
motion_callback_ = callback;
if (motion_callback_) {
// accel_range = channels_->GetControlValue(Option::ACCELEROMETER_RANGE);
// gyro_range = channels_->GetControlValue(Option::GYROSCOPE_RANGE);
accel_range = channels_->GetControlValue(Option::ACCELEROMETER_RANGE);
gyro_range = channels_->GetControlValue(Option::GYROSCOPE_RANGE);
channels_->SetImuCallback([this](const ImuPacket &packet) {
if (!motion_callback_ && !motion_datas_enabled_) {
LOG(WARNING) << "";

View File

@ -33,23 +33,6 @@ int main(int argc, char *argv[]) {
return 1;
device->InitResolution(Resolution::RES_1280x400);
device->SetStreamRequest(Format::BGR888, FrameRate::RATE_30_FPS);
/*
{ // auto-exposure
device->SetOptionValue(Option::EXPOSURE_MODE, 0);
device->SetOptionValue(Option::MAX_GAIN, 40); // [0.48]
device->SetOptionValue(Option::MAX_EXPOSURE_TIME, 120); // [0,240]
device->SetOptionValue(Option::DESIRED_BRIGHTNESS, 200); // [0,255]
}
{ // manual-exposure
device->SetOptionValue(Option::EXPOSURE_MODE, 1);
device->SetOptionValue(Option::GAIN, 20); // [0.48]
device->SetOptionValue(Option::BRIGHTNESS, 20); // [0,240]
device->SetOptionValue(Option::CONTRAST, 20); // [0,255]
}
device->SetOptionValue(Option::IR_CONTROL, 80);
device->SetOptionValue(Option::FRAME_RATE, 25);
device->SetOptionValue(Option::IMU_FREQUENCY, 500);
*/
device->LogOptionInfos();
// Enable this will cache the motion datas until you get them.