diff --git a/samples/tutorials/control/auto_exposure.cc b/samples/tutorials/control/auto_exposure.cc
index 72dcae6..ba5ae65 100644
--- a/samples/tutorials/control/auto_exposure.cc
+++ b/samples/tutorials/control/auto_exposure.cc
@@ -24,6 +24,7 @@ int main(int argc, char *argv[]) {
auto &&api = API::Create(argc, argv);
if (!api) return 1;
+ std::int32_t frame_rate = 0;
bool ok;
auto &&request = api->SelectStreamRequest(&ok);
if (!ok) return 1;
@@ -43,6 +44,8 @@ int main(int argc, char *argv[]) {
// desired_brightness: range [0,255], default 192
api->SetOptionValue(Option::DESIRED_BRIGHTNESS, 192);
+ frame_rate = api->GetOptionValue(Option::FRAME_RATE);
+
LOG(INFO) << "Enable auto-exposure";
LOG(INFO) << "Set EXPOSURE_MODE to "
<< api->GetOptionValue(Option::EXPOSURE_MODE);
@@ -83,7 +86,7 @@ int main(int argc, char *argv[]) {
api->Start(Source::VIDEO_STREAMING);
- CVPainter painter(30);
+ CVPainter painter(frame_rate);
cv::namedWindow("frame");
diff --git a/samples/tutorials/control/manual_exposure.cc b/samples/tutorials/control/manual_exposure.cc
index 8c84deb..51f1a44 100644
--- a/samples/tutorials/control/manual_exposure.cc
+++ b/samples/tutorials/control/manual_exposure.cc
@@ -24,6 +24,7 @@ int main(int argc, char *argv[]) {
auto &&api = API::Create(argc, argv);
if (!api) return 1;
+ std::int32_t frame_rate = 0;
bool ok;
auto &&request = api->SelectStreamRequest(&ok);
if (!ok) return 1;
@@ -42,6 +43,8 @@ int main(int argc, char *argv[]) {
// contrast/black_level_calibration: range [0,255], default 127
api->SetOptionValue(Option::CONTRAST, 127);
+ frame_rate = api->GetOptionValue(Option::FRAME_RATE);
+
LOG(INFO) << "Enable manual-exposure";
LOG(INFO) << "Set EXPOSURE_MODE to "
<< api->GetOptionValue(Option::EXPOSURE_MODE);
@@ -68,7 +71,7 @@ int main(int argc, char *argv[]) {
api->Start(Source::VIDEO_STREAMING);
- CVPainter painter(30);
+ CVPainter painter(frame_rate);
cv::namedWindow("frame");
diff --git a/samples/tutorials/util/cv_painter.cc b/samples/tutorials/util/cv_painter.cc
index cc9fefe..d5a1271 100644
--- a/samples/tutorials/util/cv_painter.cc
+++ b/samples/tutorials/util/cv_painter.cc
@@ -82,7 +82,7 @@ cv::Rect CVPainter::DrawImgData(
std::ostringstream ss;
ss << "frame_id: " << data.frame_id;
- ss << ", stamp: " << fmt_time << (0.01f * data.timestamp); // ms
+ ss << ", stamp: " << fmt_time << (0.001f * data.timestamp); // ms
ss << ", expo: ";
if (frame_rate_ == 0) {
ss << data.exposure_time;
diff --git a/wrappers/ros/src/mynt_eye_ros_wrapper/launch/mynteye.launch b/wrappers/ros/src/mynt_eye_ros_wrapper/launch/mynteye.launch
index d08d91f..0487305 100644
--- a/wrappers/ros/src/mynt_eye_ros_wrapper/launch/mynteye.launch
+++ b/wrappers/ros/src/mynt_eye_ros_wrapper/launch/mynteye.launch
@@ -52,9 +52,6 @@
-
-
-
@@ -64,47 +61,101 @@
-
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -155,18 +206,18 @@
-
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/wrappers/ros/src/mynt_eye_ros_wrapper/rviz/mynteye.rviz b/wrappers/ros/src/mynt_eye_ros_wrapper/rviz/mynteye.rviz
index 7ad1d90..c448a18 100644
--- a/wrappers/ros/src/mynt_eye_ros_wrapper/rviz/mynteye.rviz
+++ b/wrappers/ros/src/mynt_eye_ros_wrapper/rviz/mynteye.rviz
@@ -78,34 +78,6 @@ Visualization Manager:
Transport Hint: raw
Unreliable: false
Value: true
- - Class: rviz/Group
- Displays:
- - Class: rviz/Image
- Enabled: true
- Image Topic: /mynteye/left/image_mono
- Max Value: 1
- Median window: 5
- Min Value: 0
- Name: LeftMono
- Normalize Range: true
- Queue Size: 2
- Transport Hint: raw
- Unreliable: false
- Value: true
- - Class: rviz/Image
- Enabled: true
- Image Topic: /mynteye/right/image_mono
- Max Value: 1
- Median window: 5
- Min Value: 0
- Name: RightMono
- Normalize Range: true
- Queue Size: 2
- Transport Hint: raw
- Unreliable: false
- Value: true
- Enabled: true
- Name: Mono
- Class: rviz/Group
Displays:
- Class: rviz/Image
diff --git a/wrappers/ros/src/mynt_eye_ros_wrapper/src/wrapper_nodelet.cc b/wrappers/ros/src/mynt_eye_ros_wrapper/src/wrapper_nodelet.cc
index 634133c..e74f322 100644
--- a/wrappers/ros/src/mynt_eye_ros_wrapper/src/wrapper_nodelet.cc
+++ b/wrappers/ros/src/mynt_eye_ros_wrapper/src/wrapper_nodelet.cc
@@ -104,31 +104,31 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
static_cast(_hard_time - hard_time_begin) * 0.000001f));
}
- inline bool is_overflow(std::uint32_t now,
- std::uint32_t pre) {
+ inline bool is_overflow(std::uint64_t now,
+ std::uint64_t pre) {
static std::uint64_t unit =
std::numeric_limits::max();
return (now < pre) && ((pre - now) > (unit / 2));
}
- inline bool is_repeated(std::uint32_t now,
- std::uint32_t pre) {
+ inline bool is_repeated(std::uint64_t now,
+ std::uint64_t pre) {
return now == pre;
}
- inline bool is_annormal(std::uint32_t now,
- std::uint32_t pre) {
+ inline bool is_annormal(std::uint64_t now,
+ std::uint64_t pre) {
static std::uint64_t unit =
std::numeric_limits::max();
return (now < pre) && ((pre - now) < (unit / 4));
}
- ros::Time checkUpTimeStamp(std::uint32_t _hard_time,
+ ros::Time checkUpTimeStamp(std::uint64_t _hard_time,
const Stream &stream) {
- static std::map hard_time_now;
- static std::map acc;
+ static std::map hard_time_now;
+ static std::map acc;
static std::uint64_t unit_hard_time =
std::numeric_limits::max();
@@ -145,18 +145,21 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
acc[stream] * unit_hard_time + _hard_time);
}
- ros::Time checkUpImuTimeStamp(std::uint32_t _hard_time) {
- static std::uint32_t hard_time_now(0), acc(0);
+ ros::Time checkUpImuTimeStamp(std::uint64_t _hard_time) {
+ static std::uint64_t hard_time_now(0), acc(0);
static std::uint64_t unit_hard_time =
std::numeric_limits::max();
if (is_overflow(_hard_time, hard_time_now)) {
acc++;
- } else if (is_repeated(_hard_time, hard_time_now)) {
+ }
+ /*
+ else if (is_repeated(_hard_time, hard_time_now)) {
NODELET_INFO_STREAM("WARNING:: Imu time stamp is repeated.");
} else if (is_annormal(_hard_time, hard_time_now)) {
NODELET_INFO_STREAM("WARNING:: Imu time stamp is annormal.");
}
+ */
hard_time_now = _hard_time;
return hardTimeToSoftTime(
@@ -166,10 +169,8 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
void onInit() override {
nh_ = getMTNodeHandle();
private_nh_ = getMTPrivateNodeHandle();
- int request_index = 0;
- private_nh_.getParam("request_index", request_index);
- initDevice(request_index);
+ initDevice();
NODELET_FATAL_COND(api_ == nullptr, "No MYNT EYE device selected :(");
// node params
@@ -225,20 +226,39 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
gravity_ = 9.8;
private_nh_.getParam("gravity", gravity_);
- // device options
+ // device options of standard2
+ if (model_ == Model::STANDARD2) {
+ option_names_ = {
+ {Option::BRIGHTNESS, "standard2/brightness"},
+ {Option::EXPOSURE_MODE, "standard2/exposure_mode"},
+ {Option::MAX_GAIN, "standard2/max_gain"},
+ {Option::MAX_EXPOSURE_TIME, "standard2/max_exposure_time"},
+ {Option::DESIRED_BRIGHTNESS, "standard2/desired_brightness"},
+ {Option::MIN_EXPOSURE_TIME, "standard2/min_exposure_time"},
+ {Option::ACCELEROMETER_RANGE, "standard2/accel_range"},
+ {Option::GYROSCOPE_RANGE, "standard2/gyro_range"},
+ {Option::ACCELEROMETER_LOW_PASS_FILTER, "standard2/accel_low_filter"},
+ {Option::GYROSCOPE_LOW_PASS_FILTER, "standard2/gyro_low_filter"}};
+ }
+ // device options of standard
+ if (model_ == Model::STANDARD) {
+ option_names_ = {
+ {Option::GAIN, "STANDARD/gain"},
+ {Option::BRIGHTNESS, "STANDARD/brightness"},
+ {Option::CONTRAST, "STANDARD/contrast"},
+ {Option::FRAME_RATE, "STANDARD/frame_rate"},
+ {Option::IMU_FREQUENCY, "STANDARD/imu_frequency"},
+ {Option::EXPOSURE_MODE, "STANDARD/exposure_mode"},
+ {Option::MAX_GAIN, "STANDARD/max_gain"},
+ {Option::MAX_EXPOSURE_TIME, "STANDARD/max_exposure_time"},
+ {Option::DESIRED_BRIGHTNESS, "STANDARD/desired_brightness"},
+ {Option::IR_CONTROL, "STANDARD/ir_control"},
+ {Option::HDR_MODE, "STANDARD/hdr_mode"},
+ {Option::ACCELEROMETER_RANGE, "STANDARD/accel_range"},
+ {Option::GYROSCOPE_RANGE, "STANDARD/gyro_range"}};
+ }
- std::map