Merge branch 'develop' of http://gitlab.mynt.com/mynteye/mynt-eye-s-sdk into develop

This commit is contained in:
TinyOh 2019-03-25 16:54:59 +08:00
commit 8811036be0
11 changed files with 72 additions and 54 deletions

View File

@ -259,6 +259,14 @@ enum class Option : std::uint8_t {
*/
GYROSCOPE_LOW_PASS_FILTER,
/**
* The setting of IIC address
* <p>
* range: [0,65535], default: 0
* </p>
*/
IIC_ADDRESS_SETTING,
/** Zero drift calibration */
ZERO_DRIFT_CALIBRATION,
/** Erase chip */

View File

@ -80,6 +80,9 @@ int XuCamCtrlId(Option option) {
case Option::GYROSCOPE_LOW_PASS_FILTER:
return 12;
break;
case Option::IIC_ADDRESS_SETTING:
return 13;
break;
default:
LOG(FATAL) << "No cam ctrl id for " << option;
}
@ -148,7 +151,8 @@ void Channels::UpdateControlInfos() {
Option::DESIRED_BRIGHTNESS, Option::IR_CONTROL,
Option::HDR_MODE, Option::ACCELEROMETER_RANGE,
Option::GYROSCOPE_RANGE, Option::ACCELEROMETER_LOW_PASS_FILTER,
Option::GYROSCOPE_LOW_PASS_FILTER}) {
Option::GYROSCOPE_LOW_PASS_FILTER,
Option::IIC_ADDRESS_SETTING}) {
if (supports.find(option) != supports.end())
control_infos_[option] = XuControlInfo(option);
}
@ -196,6 +200,7 @@ std::int32_t Channels::GetControlValue(const Option &option) const {
case Option::GYROSCOPE_RANGE:
case Option::ACCELEROMETER_LOW_PASS_FILTER:
case Option::GYROSCOPE_LOW_PASS_FILTER:
case Option::IIC_ADDRESS_SETTING:
return XuCamCtrlGet(option);
case Option::ZERO_DRIFT_CALIBRATION:
case Option::ERASE_CHIP:
@ -277,7 +282,8 @@ void Channels::SetControlValue(const Option &option, std::int32_t value) {
case Option::DESIRED_BRIGHTNESS:
case Option::IR_CONTROL:
case Option::HDR_MODE:
case Option::MIN_EXPOSURE_TIME: {
case Option::MIN_EXPOSURE_TIME:
case Option::IIC_ADDRESS_SETTING: {
if (!in_range())
break;
XuCamCtrlSet(option, value);
@ -313,6 +319,7 @@ bool Channels::RunControlAction(const Option &option) const {
case Option::GYROSCOPE_RANGE:
case Option::ACCELEROMETER_LOW_PASS_FILTER:
case Option::GYROSCOPE_LOW_PASS_FILTER:
case Option::IIC_ADDRESS_SETTING:
LOG(WARNING) << option << " run action useless";
return false;
default:

View File

@ -53,7 +53,7 @@ const std::map<Model, OptionSupports> option_supports_map = {
Option::MIN_EXPOSURE_TIME, Option::DESIRED_BRIGHTNESS,
Option::ACCELEROMETER_RANGE, Option::GYROSCOPE_RANGE,
Option::ACCELEROMETER_LOW_PASS_FILTER, Option::GYROSCOPE_LOW_PASS_FILTER,
Option::ERASE_CHIP}
Option::IIC_ADDRESS_SETTING, Option::ERASE_CHIP}
}
};

View File

@ -122,6 +122,7 @@ const char *to_string(const Option &value) {
CASE(GYROSCOPE_RANGE)
CASE(ACCELEROMETER_LOW_PASS_FILTER)
CASE(GYROSCOPE_LOW_PASS_FILTER)
CASE(IIC_ADDRESS_SETTING)
CASE(ZERO_DRIFT_CALIBRATION)
CASE(ERASE_CHIP)
default:

View File

@ -95,6 +95,11 @@ enum class Option : int {
* values: {23,64}, default: 64
*/
GYROSCOPE_LOW_PASS_FILTER,
/**
* The setting of IIC address
* range: [0,65535], default: 0
*/
IIC_ADDRESS_SETTING,
/** Zero drift calibration */
ZERO_DRIFT_CALIBRATION,
/** Erase chip */

View File

@ -277,6 +277,8 @@ RawOption from_jni(const JniOption& Option) {
return RawOption::ACCELEROMETER_LOW_PASS_FILTER;
case JniOption::GYROSCOPE_LOW_PASS_FILTER:
return RawOption::GYROSCOPE_LOW_PASS_FILTER;
case JniOption::IIC_ADDRESS_SETTING:
return RawOption::IIC_ADDRESS_SETTING;
case JniOption::ZERO_DRIFT_CALIBRATION:
return RawOption::ZERO_DRIFT_CALIBRATION;
case JniOption::ERASE_CHIP:
@ -321,6 +323,8 @@ JniOption to_jni(const RawOption& Option) {
return JniOption::ACCELEROMETER_LOW_PASS_FILTER;
case RawOption::GYROSCOPE_LOW_PASS_FILTER:
return JniOption::GYROSCOPE_LOW_PASS_FILTER;
case JniOption::IIC_ADDRESS_SETTING:
return RawOption::IIC_ADDRESS_SETTING;
case RawOption::ZERO_DRIFT_CALIBRATION:
return JniOption::ZERO_DRIFT_CALIBRATION;
case RawOption::ERASE_CHIP:

View File

@ -95,6 +95,11 @@ public enum Option {
* values: {23,64}, default: 64
*/
GYROSCOPE_LOW_PASS_FILTER,
/**
* The setting of IIC address
* range: [0,65535], default: 0
*/
IIC_ADDRESS_SETTING,
/** Zero drift calibration */
ZERO_DRIFT_CALIBRATION,
/** Erase chip */

View File

@ -178,6 +178,10 @@ option = enum {
# values: {23,64}, default: 64
gyroscope_low_pass_filter;
iic_address_setting;
# The setting of IIC address
# range: [0,65535], default: 0
# Zero drift calibration
zero_drift_calibration;
# Erase chip

View File

@ -106,3 +106,7 @@ standard210a/accel_low_filter: -1
# standard210a/gyro_low_filter range: [23,64]
standard210a/gyro_low_filter: -1
# standard210a/gyro_low_filter: 64
# standard210a/iic_address_setting range: [0,65535]
standard210a/iic_address_setting: -1
# standard210a/iic_address_setting: 0

View File

@ -2,6 +2,4 @@
<launch>
<include file="$(find mynt_eye_ros_wrapper)/launch/sub/mynteye_1.launch" />
<include file="$(find mynt_eye_ros_wrapper)/launch/sub/mynteye_2.launch" />
<!-- <include file="$(find mynt_eye_ros_wrapper)/launch/sub/mynteye_3.launch" />
<include file="$(find mynt_eye_ros_wrapper)/launch/sub/mynteye_4.launch" /> -->
</launch>

View File

@ -250,7 +250,8 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
{Option::GYROSCOPE_RANGE, "standard210a/gyro_range"},
{Option::ACCELEROMETER_LOW_PASS_FILTER,
"standard210a/accel_low_filter"},
{Option::GYROSCOPE_LOW_PASS_FILTER, "standard210a/gyro_low_filter"}};
{Option::GYROSCOPE_LOW_PASS_FILTER, "standard210a/gyro_low_filter"}
{Option::IIC_ADDRESS_SETTING, "standard2/iic_address_setting"}};
}
// device options of standard2
@ -1098,6 +1099,18 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
Context context;
auto &&devices = context.devices();
size_t n = devices.size();
NODELET_FATAL_COND(n <= 0, "No MYNT EYE devices :(");
NODELET_INFO_STREAM("MYNT EYE devices:");
for (size_t i = 0; i < n; i++) {
auto &&device = devices[i];
auto &&name = device->GetInfo(Info::DEVICE_NAME);
auto &&serial_number = device->GetInfo(Info::SERIAL_NUMBER);
NODELET_INFO_STREAM(" index: " << i << ", name: " <<
name << ", serial number: " << serial_number);
}
bool is_multiple = false;
private_nh_.getParam("is_multiple", is_multiple);
if (is_multiple) {
@ -1106,48 +1119,16 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
NODELET_FATAL_COND(sn.empty(), "Must set serial_number "
"in mynteye_1.launch and mynteye_2.launch.");
size_t n = devices.size();
NODELET_FATAL_COND(n <= 0, "No MYNT EYE devices :(");
NODELET_INFO_STREAM("MYNT EYE devices:");
for (size_t i = 0; i < n; i++) {
auto &&device = devices[i];
auto &&name = device->GetInfo(Info::DEVICE_NAME);
auto &&serial_number = device->GetInfo(Info::SERIAL_NUMBER);
NODELET_INFO_STREAM(" index: " << i << ", name: " <<
name << ", serial number: " << serial_number);
}
for (size_t i = 0; i < n; i++) {
auto &&device = devices[i];
auto &&name = device->GetInfo(Info::DEVICE_NAME);
auto &&serial_number = device->GetInfo(Info::SERIAL_NUMBER);
NODELET_INFO_STREAM(" index: " << i << ", name: " <<
name << ", serial number: " << serial_number);
if (sn == serial_number)
return device;
#if 0
if (i == (n - 1)) {
/*
NODELET_FATAL_COND(i == (n - 1), "No corresponding device was found,"
" check the serial_number configuration. ");
*/
NODELET_FATAL_COND(i == (n - 1), "No corresponding device was found,"
" check the serial_number configuration. ");
return nullptr;
}
#endif
}
}
size_t n = devices.size();
NODELET_FATAL_COND(n <= 0, "No MYNT EYE devices :(");
NODELET_INFO_STREAM("MYNT EYE devices:");
for (size_t i = 0; i < n; i++) {
auto &&device = devices[i];
auto &&name = device->GetInfo(Info::DEVICE_NAME);
NODELET_INFO_STREAM(" index: " << i << ", name: " << name);
}
} else {
if (n <= 1) {
NODELET_INFO_STREAM("Only one MYNT EYE device, select index: 0");
return devices[0];
@ -1164,6 +1145,7 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
return devices[i];
}
}
}
return nullptr;
}