Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notification category for Relocalization #4936

Merged
merged 3 commits into from
Oct 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/librealsense2/h/rs_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ typedef enum rs2_notification_category{
RS2_NOTIFICATION_CATEGORY_HARDWARE_EVENT, /**< General Hardeware notification that is not an error */
RS2_NOTIFICATION_CATEGORY_UNKNOWN_ERROR, /**< Received unknown error from the device */
RS2_NOTIFICATION_CATEGORY_FIRMWARE_UPDATE_RECOMMENDED, /**< Current firmware version installed is not the latest available */
RS2_NOTIFICATION_CATEGORY_POSE_RELOCALIZATION, /**< A relocalization event has updated the pose provided by a pose sensor */
RS2_NOTIFICATION_CATEGORY_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
} rs2_notification_category;
const char* rs2_notification_category_to_string(rs2_notification_category category);
Expand Down
9 changes: 8 additions & 1 deletion src/tm2/tm-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ namespace librealsense
void tm2_sensor::onRelocalizationEvent(perc::TrackingData::RelocalizationEvent& evt)
{
std::string msg = to_string() << "T2xx: Relocalization occurred. id: " << evt.sessionId << ", timestamp: " << double(evt.timestamp*0.000000001) << " sec";
raise_hardware_event(msg, {}, evt.timestamp);
raise_relocalization_event(msg, evt.timestamp);
}

void tm2_sensor::enable_loopback(std::shared_ptr<playback_device> input)
Expand Down Expand Up @@ -1356,6 +1356,13 @@ namespace librealsense
_source.invoke_callback(std::move(frame));
}

void tm2_sensor::raise_relocalization_event(const std::string& msg, double timestamp)
{
notification event{ RS2_NOTIFICATION_CATEGORY_POSE_RELOCALIZATION, 0, RS2_LOG_SEVERITY_INFO, msg };
event.timestamp = timestamp;
get_notifications_processor()->raise_notification(event);
}

void tm2_sensor::raise_hardware_event(const std::string& msg, const std::string& json_data, double timestamp)
{
notification controller_event{ RS2_NOTIFICATION_CATEGORY_HARDWARE_EVENT, 0, RS2_LOG_SEVERITY_INFO, msg };
Expand Down
1 change: 1 addition & 0 deletions src/tm2/tm-device.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ namespace librealsense
private:
void handle_imu_frame(perc::TrackingData::TimestampedData& tm_frame_ts, unsigned long long frame_number, rs2_stream stream_type, int index, float3 imu_data, float temperature);
void pass_frames_to_fw(frame_holder fref);
void raise_relocalization_event(const std::string& msg, double timestamp);
void raise_hardware_event(const std::string& msg, const std::string& serialized_data, double timestamp);
void raise_error_notification(const std::string& msg);

Expand Down
1 change: 1 addition & 0 deletions src/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ namespace librealsense
CASE(HARDWARE_EVENT)
CASE(UNKNOWN_ERROR)
CASE(FIRMWARE_UPDATE_RECOMMENDED)
CASE(POSE_RELOCALIZATION)
default: assert(!is_valid(value)); return UNKNOWN_VALUE;
}
#undef CASE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@ public enum NotificationCategory

/// <summary> Current firmware version installed is not the latest available</summary>
FirmwareUpdateRecommended = 5,

/// <summary> A relocalization event has updated the pose provided by a pose sensor</summary>
PoseRelocalization = 6,
}
}