Add constraints to imu's parameter settings
This commit is contained in:
parent
33e38bba2f
commit
30363e18c6
|
@ -236,6 +236,7 @@ std::shared_ptr<API> API::Create(
|
||||||
return std::make_shared<API>(device);
|
return std::make_shared<API>(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(Kalman): Compatible with two generation
|
||||||
std::shared_ptr<API> API::Create(std::shared_ptr<Device> device) {
|
std::shared_ptr<API> API::Create(std::shared_ptr<Device> device) {
|
||||||
return Create(device, Resolution::RES_2560x800);
|
return Create(device, Resolution::RES_2560x800);
|
||||||
}
|
}
|
||||||
|
@ -245,6 +246,7 @@ std::shared_ptr<API> API::Create(int argc, char *argv[]) {
|
||||||
return Create(argc, argv, device);
|
return Create(argc, argv, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(Kalman): Compatible with two generation
|
||||||
std::shared_ptr<API> API::Create(
|
std::shared_ptr<API> API::Create(
|
||||||
int argc, char *argv[], std::shared_ptr<Device> device) {
|
int argc, char *argv[], std::shared_ptr<Device> device) {
|
||||||
static glog_init _(argc, argv);
|
static glog_init _(argc, argv);
|
||||||
|
@ -458,6 +460,7 @@ std::shared_ptr<Device> API::device() {
|
||||||
return device_;
|
return device_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(Kalman): Call this function in the appropriate place
|
||||||
void API::CheckImageParams() {
|
void API::CheckImageParams() {
|
||||||
if (device_ != nullptr) {
|
if (device_ != nullptr) {
|
||||||
bool in_l_ok, in_r_ok, ex_l2r_ok;
|
bool in_l_ok, in_r_ok, ex_l2r_ok;
|
||||||
|
|
|
@ -142,6 +142,7 @@ void Channels::LogControlInfos() const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(Kalman): Compatible with two generation
|
||||||
void Channels::UpdateControlInfos() {
|
void Channels::UpdateControlInfos() {
|
||||||
for (auto &&option : std::vector<Option>{Option::BRIGHTNESS}) {
|
for (auto &&option : std::vector<Option>{Option::BRIGHTNESS}) {
|
||||||
control_infos_[option] = PuControlInfo(option);
|
control_infos_[option] = PuControlInfo(option);
|
||||||
|
@ -255,17 +256,33 @@ void Channels::SetControlValue(const Option &option, std::int32_t value) {
|
||||||
break;
|
break;
|
||||||
XuCamCtrlSet(option, value);
|
XuCamCtrlSet(option, value);
|
||||||
} break;
|
} break;
|
||||||
|
case Option::ACCELEROMETER_RANGE: {
|
||||||
|
if (!in_range() || !in_values({6, 12, 24, 48}))
|
||||||
|
break;
|
||||||
|
XuCamCtrlSet(option, value);
|
||||||
|
} break;
|
||||||
|
case Option::GYROSCOPE_RANGE: {
|
||||||
|
if (!in_range() || !in_values({6, 12, 24, 48}))
|
||||||
|
break;
|
||||||
|
XuCamCtrlSet(option, value);
|
||||||
|
} break;
|
||||||
|
case Option::ACCELEROMETER_LOW_PASS_FILTER: {
|
||||||
|
if (!in_range() || !in_values({0, 1, 2}))
|
||||||
|
break;
|
||||||
|
XuCamCtrlSet(option, value);
|
||||||
|
} break;
|
||||||
|
case Option::GYROSCOPE_LOW_PASS_FILTER: {
|
||||||
|
if (!in_range() || !in_values({23, 64}))
|
||||||
|
break;
|
||||||
|
XuCamCtrlSet(option, value);
|
||||||
|
} break;
|
||||||
case Option::EXPOSURE_MODE:
|
case Option::EXPOSURE_MODE:
|
||||||
case Option::MAX_GAIN:
|
case Option::MAX_GAIN:
|
||||||
case Option::MAX_EXPOSURE_TIME:
|
case Option::MAX_EXPOSURE_TIME:
|
||||||
case Option::DESIRED_BRIGHTNESS:
|
case Option::DESIRED_BRIGHTNESS:
|
||||||
case Option::IR_CONTROL:
|
case Option::IR_CONTROL:
|
||||||
case Option::HDR_MODE:
|
case Option::HDR_MODE:
|
||||||
case Option::MIN_EXPOSURE_TIME:
|
case Option::MIN_EXPOSURE_TIME: {
|
||||||
case Option::ACCELEROMETER_RANGE:
|
|
||||||
case Option::GYROSCOPE_RANGE:
|
|
||||||
case Option::ACCELEROMETER_LOW_PASS_FILTER:
|
|
||||||
case Option::GYROSCOPE_LOW_PASS_FILTER: {
|
|
||||||
if (!in_range())
|
if (!in_range())
|
||||||
break;
|
break;
|
||||||
XuCamCtrlSet(option, value);
|
XuCamCtrlSet(option, value);
|
||||||
|
@ -545,6 +562,7 @@ std::size_t from_data(
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(Kalman): Is there a more elegant way?
|
||||||
std::size_t from_data(
|
std::size_t from_data(
|
||||||
Channels::img_params_t *img_params, const std::uint8_t *data,
|
Channels::img_params_t *img_params, const std::uint8_t *data,
|
||||||
const Version *spec_version) {
|
const Version *spec_version) {
|
||||||
|
@ -659,6 +677,7 @@ bool Channels::GetFiles(
|
||||||
if (img_params->ok) {
|
if (img_params->ok) {
|
||||||
CheckSpecVersion(spec_ver);
|
CheckSpecVersion(spec_ver);
|
||||||
from_data(img_params, data + i, spec_ver);
|
from_data(img_params, data + i, spec_ver);
|
||||||
|
// Considering the upgrade, comment this
|
||||||
// CHECK_EQ(from_data(img_params, data + i, spec_ver), file_size);
|
// CHECK_EQ(from_data(img_params, data + i, spec_ver), file_size);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
|
@ -21,6 +21,7 @@ const std::map<Model, StreamSupports> stream_supports_map = {
|
||||||
const std::map<Model, CapabilitiesSupports> capabilities_supports_map = {
|
const std::map<Model, CapabilitiesSupports> capabilities_supports_map = {
|
||||||
{Model::STANDARD, {Capabilities::STEREO_COLOR, Capabilities::IMU}}};
|
{Model::STANDARD, {Capabilities::STEREO_COLOR, Capabilities::IMU}}};
|
||||||
|
|
||||||
|
// TODO(Kalman): Compatible with two generation
|
||||||
const std::map<Model, OptionSupports> option_supports_map = {
|
const std::map<Model, OptionSupports> option_supports_map = {
|
||||||
{Model::STANDARD,
|
{Model::STANDARD,
|
||||||
{Option::BRIGHTNESS, Option::EXPOSURE_MODE, Option::MAX_GAIN,
|
{Option::BRIGHTNESS, Option::EXPOSURE_MODE, Option::MAX_GAIN,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user