Class MegaGoTracker
Provide device-side positioning function.
MegaGoTracker occupies 2 camera buffers.
MegaGoTracker
Methods
isAvailable
Check if the component is available. On Android, it requires API Level 24 or higher; all platforms need to meet the necessary runtime dependencies.
bool easyar_MegaGoTracker_isAvailable(void)
static bool isAvailable()
public static boolean isAvailable()
companion object fun isAvailable(): Boolean
public static func isAvailable() -> Bool
public static bool isAvailable()
Returns
Input frame input port. The input frame must contain an image, camera parameters, and a timestamp. The 6DoF spatial information must contain cameraTransform and trackingStatus. Refer to InputFrameSink.
void easyar_MegaGoTracker_inputFrameSink(easyar_MegaGoTracker * This, easyar_InputFrameSink * * Return)
std::shared_ptr<InputFrameSink> inputFrameSink()
public @Nonnull InputFrameSink inputFrameSink()
fun inputFrameSink(): InputFrameSink
- (easyar_InputFrameSink *)inputFrameSink
public func inputFrameSink() -> InputFrameSink
public virtual InputFrameSink inputFrameSink()
Returns
accelerometerResultSink
void easyar_MegaGoTracker_accelerometerResultSink(easyar_MegaGoTracker * This, easyar_AccelerometerResultSink * * Return)
std::shared_ptr<AccelerometerResultSink> accelerometerResultSink()
public @Nonnull AccelerometerResultSink accelerometerResultSink()
fun accelerometerResultSink(): AccelerometerResultSink
- (easyar_AccelerometerResultSink *)accelerometerResultSink
public func accelerometerResultSink() -> AccelerometerResultSink
public virtual AccelerometerResultSink accelerometerResultSink()
Returns
bufferRequirement
The number of camera buffers occupied by the current component.
int easyar_MegaGoTracker_bufferRequirement(const easyar_MegaGoTracker * This)
public int bufferRequirement()
fun bufferRequirement(): Int
public func bufferRequirement() -> Int32
public virtual int bufferRequirement()
Returns
outputFrameSource
void easyar_MegaGoTracker_outputFrameSource(easyar_MegaGoTracker * This, easyar_OutputFrameSource * * Return)
std::shared_ptr<OutputFrameSource> outputFrameSource()
public @Nonnull OutputFrameSource outputFrameSource()
fun outputFrameSource(): OutputFrameSource
- (easyar_OutputFrameSource *)outputFrameSource
public func outputFrameSource() -> OutputFrameSource
public virtual OutputFrameSource outputFrameSource()
Returns
create
void easyar_MegaGoTracker_create(easyar_MegaGoTracker * * Return)
static std::shared_ptr<MegaGoTracker> create()
public static @Nonnull MegaGoTracker create()
companion object fun create(): MegaGoTracker
+ (easyar_MegaGoTracker *)create
public static func create() throws -> MegaGoTracker
public static MegaGoTracker create()
Returns
Extract block information from the map file.
void easyar_MegaGoTracker_extractBlockInfoFromFile(easyar_String * path, easyar_OptionalOfMegaGoBlockInfo * Return)
static std::optional<std::shared_ptr<MegaGoBlockInfo>> extractBlockInfoFromFile(std::string path)
public static @Nullable MegaGoBlockInfo extractBlockInfoFromFile(java.lang.@Nonnull String path)
companion object fun extractBlockInfoFromFile(path: String): MegaGoBlockInfo?
+ (easyar_MegaGoBlockInfo *)extractBlockInfoFromFile:(NSString *)path
public static func extractBlockInfoFromFile(_ path: String) -> MegaGoBlockInfo?
public static Optional<MegaGoBlockInfo> extractBlockInfoFromFile(string path)
Parameters
| Name |
Type |
Description |
| path |
String |
|
Returns
Extract block information from the map memory data.
void easyar_MegaGoTracker_extractBlockInfoFromBuffer(easyar_Buffer * buffer, easyar_OptionalOfMegaGoBlockInfo * Return)
static std::optional<std::shared_ptr<MegaGoBlockInfo>> extractBlockInfoFromBuffer(std::shared_ptr<Buffer> buffer)
public static @Nullable MegaGoBlockInfo extractBlockInfoFromBuffer(@Nonnull Buffer buffer)
companion object fun extractBlockInfoFromBuffer(buffer: Buffer): MegaGoBlockInfo?
+ (easyar_MegaGoBlockInfo *)extractBlockInfoFromBuffer:(easyar_Buffer *)buffer
public static func extractBlockInfoFromBuffer(_ buffer: Buffer) -> MegaGoBlockInfo?
public static Optional<MegaGoBlockInfo> extractBlockInfoFromBuffer(Buffer buffer)
Parameters
| Name |
Type |
Description |
| buffer |
Buffer |
|
Returns
setEnableStatelessLocalization
Set whether to enable stateless positioning. When stateless positioning is enabled, the previous positioning result will not be used during positioning. The default value is false.
void easyar_MegaGoTracker_setEnableStatelessLocalization(easyar_MegaGoTracker * This, bool enableStatelessLocalization)
void setEnableStatelessLocalization(bool enableStatelessLocalization)
public void setEnableStatelessLocalization(boolean enableStatelessLocalization)
fun setEnableStatelessLocalization(enableStatelessLocalization: Boolean): Unit
- (void)setEnableStatelessLocalization:(bool)enableStatelessLocalization
public func setEnableStatelessLocalization(_ enableStatelessLocalization: Bool) -> Void
public virtual void setEnableStatelessLocalization(bool enableStatelessLocalization)
Parameters
| Name |
Type |
Description |
| enableStatelessLocalization |
Boolean |
|
Returns
setResultAsyncMode
Set the asynchronous mode for the results. If the results are output via outputFrameSource, it should be set to true; if the results are obtained via getSyncResult, it should be set to false. The default value is true. The synchronous mode is only available when using an XR License. Returns true when the requested mode is successfully applied; returns false and keeps the asynchronous mode when the synchronous mode is not supported.
bool easyar_MegaGoTracker_setResultAsyncMode(easyar_MegaGoTracker * This, bool enableAsync)
bool setResultAsyncMode(bool enableAsync)
public boolean setResultAsyncMode(boolean enableAsync)
fun setResultAsyncMode(enableAsync: Boolean): Boolean
- (bool)setResultAsyncMode:(bool)enableAsync
public func setResultAsyncMode(_ enableAsync: Bool) -> Bool
public virtual bool setResultAsyncMode(bool enableAsync)
Parameters
| Name |
Type |
Description |
| enableAsync |
Boolean |
|
Returns
status
Returns the current running status of MegaGoTracker.
easyar_MegaGoTrackerStatus easyar_MegaGoTracker_status(const easyar_MegaGoTracker * This)
MegaGoTrackerStatus status()
- (easyar_MegaGoTrackerStatus)status
public func status() -> MegaGoTrackerStatus
public virtual MegaGoTrackerStatus status()
Returns
error
Return the current error of MegaGoTracker. It is empty when there is no error.
easyar_OptionalOfMegaGoTrackerError easyar_MegaGoTracker_error(const easyar_MegaGoTracker * This)
std::optional<MegaGoTrackerError> error()
public @Nullable Integer error()
public func error() -> MegaGoTrackerError?
public virtual Optional<MegaGoTrackerError> error()
Returns
setLocalizationCallback
Set the positioning callback. When the running state is Detecting or Tracking, each valid and non - cancelled positioning response will report whether it has updated the output and the timestamp of the corresponding input frame.
void easyar_MegaGoTracker_setLocalizationCallback(easyar_MegaGoTracker * This, easyar_CallbackScheduler * callbackScheduler, easyar_FunctorOfVoidFromMegaGoTrackerLocalizationResponse callback)
void setLocalizationCallback(std::shared_ptr<CallbackScheduler> callbackScheduler, std::function<void(std::shared_ptr<MegaGoTrackerLocalizationResponse>)> callback)
public void setLocalizationCallback(@Nonnull CallbackScheduler callbackScheduler, @Nonnull FunctorOfVoidFromMegaGoTrackerLocalizationResponse callback)
fun setLocalizationCallback(callbackScheduler: CallbackScheduler, callback: FunctorOfVoidFromMegaGoTrackerLocalizationResponse): Unit
- (void)setLocalizationCallback:(easyar_CallbackScheduler *)callbackScheduler callback:(void (^)(easyar_MegaGoTrackerLocalizationResponse * response))callback
public func setLocalizationCallback(_ callbackScheduler: CallbackScheduler, _ callback: @escaping (MegaGoTrackerLocalizationResponse) -> Void) -> Void
public virtual void setLocalizationCallback(CallbackScheduler callbackScheduler, Action<MegaGoTrackerLocalizationResponse> callback)
Parameters
Returns
setCameraPositionOverride
Set the override value of the camera position relative to the map block. After setting, MegaGoTracker will output the override value instead of using the corresponding coordinates in the input frame data. It can be used to improve the accuracy of the output pose when the map information is known and the sensors are limited.
void easyar_MegaGoTracker_setCameraPositionOverride(easyar_MegaGoTracker * This, easyar_OptionalOfFloat x, easyar_OptionalOfFloat y, easyar_OptionalOfFloat z)
void setCameraPositionOverride(std::optional<float> x, std::optional<float> y, std::optional<float> z)
public void setCameraPositionOverride(java.lang.@Nullable Float x, java.lang.@Nullable Float y, java.lang.@Nullable Float z)
fun setCameraPositionOverride(x: Float?, y: Float?, z: Float?): Unit
- (void)setCameraPositionOverride:(NSNumber *)x y:(NSNumber *)y z:(NSNumber *)z
public func setCameraPositionOverride(_ x: Float?, _ y: Float?, _ z: Float?) -> Void
public virtual void setCameraPositionOverride(Optional<float> x, Optional<float> y, Optional<float> z)
Parameters
| Name |
Type |
Description |
| x |
Optional<Single> |
|
| y |
Optional<Single> |
|
| z |
Optional<Single> |
|
Returns
loadTargetFromFile
Asynchronously load a target from a file. The target can only be used for positioning after it is successfully loaded.
Only one target can be in effect at the same time. Calling this method will immediately clear the block instance currently located by the Tracker and the accumulated tracking state. If the current loading fails or is cancelled, the previous target and positioning instance will not be restored.
Calling this method will replace the pending loading requests. The ongoing loading may not stop immediately; the callback of the replaced request will be called after the operation ends, and its result status is MegaGoTargetLoadStatus.Canceled.
When the target cannot be parsed or the content is corrupted, the result status is MegaGoTargetLoadStatus.InvalidTarget.
This method will return immediately. After the loading is completed, the callback will be called on the thread specified by CallbackScheduler; when successful, the result contains the information of the loaded block. MegaGoTargetLoadStatus.Success only indicates that the target data has been successfully loaded. Subsequent verification may still be carried out or fail. The current processing status and error of the MegaGoTracker should be checked through the status and error. The pending callbacks will not be called after the MegaGoTracker is closed.
void easyar_MegaGoTracker_loadTargetFromFile(easyar_MegaGoTracker * This, easyar_String * path, easyar_CallbackScheduler * callbackScheduler, easyar_FunctorOfVoidFromMegaGoTargetLoadResult callback)
void loadTargetFromFile(std::string path, std::shared_ptr<CallbackScheduler> callbackScheduler, std::function<void(std::shared_ptr<MegaGoTargetLoadResult>)> callback)
public void loadTargetFromFile(java.lang.@Nonnull String path, @Nonnull CallbackScheduler callbackScheduler, @Nonnull FunctorOfVoidFromMegaGoTargetLoadResult callback)
fun loadTargetFromFile(path: String, callbackScheduler: CallbackScheduler, callback: FunctorOfVoidFromMegaGoTargetLoadResult): Unit
- (void)loadTargetFromFile:(NSString *)path callbackScheduler:(easyar_CallbackScheduler *)callbackScheduler callback:(void (^)(easyar_MegaGoTargetLoadResult * result))callback
public func loadTargetFromFile(_ path: String, _ callbackScheduler: CallbackScheduler, _ callback: @escaping (MegaGoTargetLoadResult) -> Void) -> Void
public virtual void loadTargetFromFile(string path, CallbackScheduler callbackScheduler, Action<MegaGoTargetLoadResult> callback)
Parameters
Returns
loadTargetFromBuffer
Asynchronously load a target from memory. A target can only be used for localization after it is successfully loaded.
Only one target can be in effect at the same time. Calling this method will immediately clear the currently localized block instance and the accumulated tracking status of the Tracker. If the current loading fails or is cancelled, the previous target and localization instance will not be restored.
Calling this method will replace the pending loading request. The ongoing loading may not stop immediately; the callback of the replaced request will be called after the operation ends, and its result status will be MegaGoTargetLoadStatus.Canceled.
When the target cannot be parsed or the content is corrupted, the result status is MegaGoTargetLoadStatus.InvalidTarget.
This method will return immediately. After the loading is completed, the callback will be called on the thread specified by CallbackScheduler; when successful, the result contains the information of the loaded block. MegaGoTargetLoadStatus.Success only indicates that the target data is successfully loaded. Subsequent verification may still be performed or fail. The current processing status and errors of the MegaGoTracker should be checked through the status and error. Callbacks that have not been executed will no longer be called after the MegaGoTracker is closed.
void easyar_MegaGoTracker_loadTargetFromBuffer(easyar_MegaGoTracker * This, easyar_Buffer * buffer, easyar_CallbackScheduler * callbackScheduler, easyar_FunctorOfVoidFromMegaGoTargetLoadResult callback)
void loadTargetFromBuffer(std::shared_ptr<Buffer> buffer, std::shared_ptr<CallbackScheduler> callbackScheduler, std::function<void(std::shared_ptr<MegaGoTargetLoadResult>)> callback)
public void loadTargetFromBuffer(@Nonnull Buffer buffer, @Nonnull CallbackScheduler callbackScheduler, @Nonnull FunctorOfVoidFromMegaGoTargetLoadResult callback)
fun loadTargetFromBuffer(buffer: Buffer, callbackScheduler: CallbackScheduler, callback: FunctorOfVoidFromMegaGoTargetLoadResult): Unit
- (void)loadTargetFromBuffer:(easyar_Buffer *)buffer callbackScheduler:(easyar_CallbackScheduler *)callbackScheduler callback:(void (^)(easyar_MegaGoTargetLoadResult * result))callback
public func loadTargetFromBuffer(_ buffer: Buffer, _ callbackScheduler: CallbackScheduler, _ callback: @escaping (MegaGoTargetLoadResult) -> Void) -> Void
public virtual void loadTargetFromBuffer(Buffer buffer, CallbackScheduler callbackScheduler, Action<MegaGoTargetLoadResult> callback)
Parameters
Returns
unloadTarget
Uninstall the current target and clear the current positioning instance and the accumulated tracking status. The logical state of the target will immediately change to unloaded.
Calling this method will also supersede all pending loading requests. An ongoing load may not stop immediately; the callback of the superseded request will be called after the operation ends, with the result status of MegaGoTargetLoadStatus.Canceled.
This method has no callback and will not wait for the uninstall operation to complete. If there is no loaded or loading target, calling this method will have no additional effect.
void easyar_MegaGoTracker_unloadTarget(easyar_MegaGoTracker * This)
public void unloadTarget()
public func unloadTarget() -> Void
public virtual void unloadTarget()
Returns
start
Start processing the input frames and output the results. Returns true when the call is successful; returns false when MegaGoTracker is closed. Repeated calls have no additional effect.
Calling this method after stop will continue to use the loaded target without reloading.
bool easyar_MegaGoTracker_start(easyar_MegaGoTracker * This)
public func start() -> Bool
public virtual bool start()
Returns
stop
Stop processing input frames and clear the currently located block instance and the accumulated tracking state. Incomplete processing results will be discarded.
The loaded targets will not be unloaded, and the incomplete target loading will not be cancelled. Their callbacks will still be called. At this time, the running state is Idle; call start to continue using the loaded targets.
void easyar_MegaGoTracker_stop(easyar_MegaGoTracker * This)
public func stop() -> Void
public virtual void stop()
Returns
close
Permanently close MegaGoTracker, stop processing input frames, clear the currently located block instances and the accumulated tracking state, unload the target, and release related resources. Repeated calls will not have additional effects.
All ongoing positioning and target loading operations will be cancelled, and callbacks that have not been executed will no longer be invoked. This method may wait for ongoing operations to finish before returning. After calling close, MegaGoTracker should not be used anymore. Calling start will return false.
void easyar_MegaGoTracker_close(easyar_MegaGoTracker * This)
public func close() -> Void
public virtual void close()
Returns
getSyncResult
Get the synchronous output result. The motionInputData must not be empty, and the synchronous mode needs to be enabled through setResultAsyncMode. When the MegaGoTracker is paused, closed, in an error state, or unable to generate a synchronous result currently, the return value is empty.
void easyar_MegaGoTracker_getSyncResult(easyar_MegaGoTracker * This, easyar_MotionInputData * motionInputData, easyar_OptionalOfMegaGoTrackerResult * Return)
std::optional<std::shared_ptr<MegaGoTrackerResult>> getSyncResult(std::shared_ptr<MotionInputData> motionInputData)
public @Nullable MegaGoTrackerResult getSyncResult(@Nonnull MotionInputData motionInputData)
fun getSyncResult(motionInputData: MotionInputData): MegaGoTrackerResult?
- (easyar_MegaGoTrackerResult *)getSyncResult:(easyar_MotionInputData *)motionInputData
public func getSyncResult(_ motionInputData: MotionInputData) -> MegaGoTrackerResult?
public virtual Optional<MegaGoTrackerResult> getSyncResult(MotionInputData motionInputData)
Parameters
Returns