mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-03 01:50:24 +08:00
iOS various updates (#1340)
* Added Data Recording Mode. Added option to filter ARKit localization jumps. * Implemented max acc relocalization filtering (working on iOS) * Fixed android build, added re-localization max acceleration parameter * ARCore Java: Fixed pose of depth not available at stamp requested * Android log fix * Added libLAS support * ios: added LAS support * updated dep install script to skip libraries already installed * CameraMobile: Fixed origin not updated if updateOnRender() is used * Default max opt error increased to 2x to reduce number of loop closures rejected. OptimizerGTSAM: updated gravity noise model to use same sigma for both parameters. * Updated license * bump 0.21.7 * updated license date
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19455" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="zah-iI-EPt">
|
||||
<device id="retina3_5" orientation="portrait" appearance="light"/>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="zah-iI-EPt">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19454"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/>
|
||||
<capability name="Image references" minToolsVersion="12.0"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
@@ -15,14 +15,14 @@
|
||||
<objects>
|
||||
<glkViewController preferredFramesPerSecond="30" id="zah-iI-EPt" customClass="ViewController" customModule="RTABMapApp" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<glkView key="view" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" drawableDepthFormat="24" enableSetNeedsDisplay="NO" id="sqF-4e-2HU">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="kPv-DO-hpd">
|
||||
<rect key="frame" x="250" y="180" width="60" height="120"/>
|
||||
<rect key="frame" x="323" y="366" width="60" height="120"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mJN-Ru-yPg" userLabel="StopButton">
|
||||
<rect key="frame" x="0.0" y="0.5" width="60" height="59"/>
|
||||
<rect key="frame" x="0.0" y="1" width="60" height="58.666666666666671"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="60" id="g9J-0P-CmQ"/>
|
||||
<constraint firstAttribute="width" constant="60" id="m06-eJ-dIn"/>
|
||||
@@ -34,7 +34,7 @@
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7Lv-u6-mGh" userLabel="RecordButton">
|
||||
<rect key="frame" x="0.0" y="60.5" width="60" height="59"/>
|
||||
<rect key="frame" x="0.0" y="61.000000000000007" width="60" height="58.666666666666664"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="60" id="DQI-eQ-v3X"/>
|
||||
<constraint firstAttribute="width" constant="60" id="Oeu-YT-wMz"/>
|
||||
@@ -50,10 +50,10 @@
|
||||
</subviews>
|
||||
</stackView>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="ozY-dg-YOd">
|
||||
<rect key="frame" x="160" y="20" width="140" height="60"/>
|
||||
<rect key="frame" x="233" y="79" width="140" height="60"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="9kh-4C-KyP" userLabel="LibraryButton">
|
||||
<rect key="frame" x="0.0" y="1" width="60" height="57.5"/>
|
||||
<rect key="frame" x="0.0" y="1.6666666666666643" width="60" height="57"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="60" id="Ekq-3J-kUL"/>
|
||||
<constraint firstAttribute="height" constant="60" id="fqe-e7-0uk"/>
|
||||
@@ -67,7 +67,7 @@
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="y53-OI-O76" userLabel="MenuButton">
|
||||
<rect key="frame" x="80" y="0.5" width="60" height="59"/>
|
||||
<rect key="frame" x="80" y="1" width="60" height="58.666666666666671"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="60" id="L5T-8h-ale"/>
|
||||
<constraint firstAttribute="width" constant="60" id="pLI-ns-KHQ"/>
|
||||
@@ -78,14 +78,14 @@
|
||||
</subviews>
|
||||
</stackView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="wordWrap" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KlF-4H-k6I">
|
||||
<rect key="frame" x="16" y="20" width="31" height="14.5"/>
|
||||
<rect key="frame" x="16" y="79" width="31" height="14.333333333333329"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.29820365646258501" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="773-n4-lob" userLabel="ViewButton">
|
||||
<rect key="frame" x="248" y="417.5" width="52" height="40.5"/>
|
||||
<rect key="frame" x="321" y="756.33333333333337" width="52" height="40"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="52" id="epT-x2-WRc"/>
|
||||
<constraint firstAttribute="height" constant="44" id="wAe-I1-qhs"/>
|
||||
@@ -96,7 +96,7 @@
|
||||
</state>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="012-W3-dOS" userLabel="CloseVisualization">
|
||||
<rect key="frame" x="75" y="434" width="170.5" height="22"/>
|
||||
<rect key="frame" x="111.33333333333333" y="772" width="170.33333333333337" height="22"/>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<state key="normal" title="Close Visualization" image="xmark.square" catalog="system">
|
||||
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
@@ -106,7 +106,7 @@
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="9oq-op-NGV" userLabel="StopCamera">
|
||||
<rect key="frame" x="98" y="433" width="124.5" height="22"/>
|
||||
<rect key="frame" x="134.33333333333334" y="771" width="124.33333333333334" height="22"/>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<state key="normal" title="Stop Camera" image="xmark.square" catalog="system">
|
||||
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
@@ -116,9 +116,9 @@
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleAspectFit" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Jj4-ow-MwD" userLabel="NewScanButtonLarge">
|
||||
<rect key="frame" x="73.5" y="224" width="173" height="32"/>
|
||||
<rect key="frame" x="86.333333333333329" y="407" width="220.66666666666669" height="38.333333333333314"/>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<state key="normal" title="Start the Camera">
|
||||
<state key="normal" title="New Mapping Session">
|
||||
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<imageReference key="image" image="plus.app" catalog="system" symbolScale="large"/>
|
||||
<preferredSymbolConfiguration key="preferredSymbolConfiguration" configurationType="font">
|
||||
@@ -130,7 +130,7 @@
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3Sc-lx-YKH">
|
||||
<rect key="frame" x="161" y="96" width="149" height="22"/>
|
||||
<rect key="frame" x="234" y="155" width="149" height="23.666666666666657"/>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<state key="normal" title="Export OBJ-PLY" image="square.and.arrow.up" catalog="system"/>
|
||||
<connections>
|
||||
@@ -138,7 +138,7 @@
|
||||
</connections>
|
||||
</button>
|
||||
<slider opaque="NO" contentMode="scaleToFill" placeholderIntrinsicWidth="114" placeholderIntrinsicHeight="30" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="80" minValue="0.0" maxValue="120" translatesAutoresizingMaskIntoConstraints="NO" id="30J-Tx-NRW" userLabel="OrthoClipDistanceSlider">
|
||||
<rect key="frame" x="-2" y="344" width="122" height="31"/>
|
||||
<rect key="frame" x="-2" y="682" width="122" height="31"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="118" id="dsv-im-K52"/>
|
||||
</constraints>
|
||||
@@ -147,7 +147,7 @@
|
||||
</connections>
|
||||
</slider>
|
||||
<slider opaque="NO" contentMode="scaleToFill" placeholderIntrinsicWidth="114" placeholderIntrinsicHeight="30" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="90" minValue="0.0" maxValue="180" translatesAutoresizingMaskIntoConstraints="NO" id="Z1x-Af-hdf" userLabel="GridRotationSlider">
|
||||
<rect key="frame" x="99" y="389" width="122" height="31"/>
|
||||
<rect key="frame" x="135.66666666666666" y="727" width="121.99999999999997" height="31"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="118" id="KDl-lP-Jj7"/>
|
||||
</constraints>
|
||||
@@ -155,8 +155,8 @@
|
||||
<action selector="rotateGridAction:" destination="zah-iI-EPt" eventType="valueChanged" id="eiC-QR-TYH"/>
|
||||
</connections>
|
||||
</slider>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Toast Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JMv-UE-cvK" userLabel="ToastLabel">
|
||||
<rect key="frame" x="116.5" y="330" width="87.5" height="20.5"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Toast Label" textAlignment="center" lineBreakMode="wordWrap" numberOfLines="4" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JMv-UE-cvK" userLabel="ToastLabel">
|
||||
<rect key="frame" x="51" y="668.33333333333337" width="291" height="20.333333333333371"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.3002232142857143" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<accessibility key="accessibilityConfiguration">
|
||||
<accessibilityTraits key="traits" staticText="YES" notEnabled="YES"/>
|
||||
@@ -170,6 +170,7 @@
|
||||
<constraints>
|
||||
<constraint firstItem="KlF-4H-k6I" firstAttribute="leading" secondItem="qAR-pI-uT2" secondAttribute="leading" constant="16" id="14l-HO-Yqo"/>
|
||||
<constraint firstItem="kPv-DO-hpd" firstAttribute="centerY" secondItem="sqF-4e-2HU" secondAttribute="centerY" id="4S8-5c-tBm"/>
|
||||
<constraint firstItem="JMv-UE-cvK" firstAttribute="leading" secondItem="sqF-4e-2HU" secondAttribute="leadingMargin" constant="35" id="Awg-pU-JkT"/>
|
||||
<constraint firstItem="KlF-4H-k6I" firstAttribute="top" secondItem="qAR-pI-uT2" secondAttribute="top" constant="20" id="CS3-Rk-Wxs"/>
|
||||
<constraint firstItem="012-W3-dOS" firstAttribute="centerX" secondItem="sqF-4e-2HU" secondAttribute="centerX" id="IsC-yB-kNs"/>
|
||||
<constraint firstItem="qAR-pI-uT2" firstAttribute="trailing" secondItem="773-n4-lob" secondAttribute="trailing" constant="20" id="N8s-Yg-VsL"/>
|
||||
@@ -178,6 +179,7 @@
|
||||
<constraint firstItem="Jj4-ow-MwD" firstAttribute="centerX" secondItem="sqF-4e-2HU" secondAttribute="centerX" id="OLx-LR-8xj"/>
|
||||
<constraint firstItem="012-W3-dOS" firstAttribute="top" secondItem="Z1x-Af-hdf" secondAttribute="bottom" constant="15" id="RpS-k0-btM"/>
|
||||
<constraint firstItem="ozY-dg-YOd" firstAttribute="top" secondItem="qAR-pI-uT2" secondAttribute="top" constant="20" id="TFT-we-noh"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="JMv-UE-cvK" secondAttribute="trailing" constant="35" id="Ya5-GD-1rM"/>
|
||||
<constraint firstItem="30J-Tx-NRW" firstAttribute="leading" secondItem="sqF-4e-2HU" secondAttribute="leading" id="ZBG-GX-P1X"/>
|
||||
<constraint firstItem="3Sc-lx-YKH" firstAttribute="top" secondItem="ozY-dg-YOd" secondAttribute="bottom" constant="16" id="abR-Tj-Nua"/>
|
||||
<constraint firstItem="qAR-pI-uT2" firstAttribute="bottom" secondItem="012-W3-dOS" secondAttribute="bottom" constant="24" id="dcl-mV-bH1"/>
|
||||
@@ -220,17 +222,17 @@
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="unsupportedDeviceMessage" id="v3G-nW-gVc" userLabel="Unsupported View Controller" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="hzM-1k-POo">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Unsupported Device" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" enabled="NO" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kZt-ct-4KD">
|
||||
<rect key="frame" x="21.5" y="165" width="277.5" height="30"/>
|
||||
<rect key="frame" x="28" y="341.33333333333331" width="337.33333333333331" height="33.666666666666686"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle1"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" enabled="NO" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4Js-Hw-3QU">
|
||||
<rect key="frame" x="21.5" y="203" width="277.5" height="74"/>
|
||||
<rect key="frame" x="28" y="383" width="337.33333333333331" height="86.333333333333314"/>
|
||||
<string key="text">This sample app requires a LiDAR-capable device, such as the second-generation iPad Pro 11-inch and fourth-generation iPad Pro 12.9-inch.</string>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<nil key="textColor"/>
|
||||
@@ -256,16 +258,16 @@
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="ellipsis.circle" catalog="system" width="128" height="121"/>
|
||||
<image name="eye" catalog="system" width="128" height="81"/>
|
||||
<image name="folder" catalog="system" width="128" height="97"/>
|
||||
<image name="ellipsis.circle" catalog="system" width="128" height="123"/>
|
||||
<image name="eye" catalog="system" width="128" height="79"/>
|
||||
<image name="folder" catalog="system" width="128" height="96"/>
|
||||
<image name="plus.app" catalog="system" width="128" height="114"/>
|
||||
<image name="record.circle" catalog="system" width="128" height="121"/>
|
||||
<image name="square.and.arrow.up" catalog="system" width="115" height="128"/>
|
||||
<image name="stop.circle" catalog="system" width="128" height="121"/>
|
||||
<image name="record.circle" catalog="system" width="128" height="123"/>
|
||||
<image name="square.and.arrow.up" catalog="system" width="108" height="128"/>
|
||||
<image name="stop.circle" catalog="system" width="128" height="123"/>
|
||||
<image name="xmark.square" catalog="system" width="128" height="114"/>
|
||||
<systemColor name="systemRedColor">
|
||||
<color red="1" green="0.23137254901960785" blue="0.18823529411764706" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -33,11 +33,12 @@ void setupCallbacksNative(const void *object, void * classPtr,
|
||||
int,
|
||||
float, float, float, float,
|
||||
int, int,
|
||||
float, float, float, float, float, float))
|
||||
float, float, float, float, float, float),
|
||||
void(*cameraInfoEventCallback)(void *, int, const char*, const char*))
|
||||
{
|
||||
if(object)
|
||||
{
|
||||
native(object)->setupSwiftCallbacks(classPtr, progressCallback, initCallback, statsUpdatedCallback);
|
||||
native(object)->setupSwiftCallbacks(classPtr, progressCallback, initCallback, statsUpdatedCallback, cameraInfoEventCallback);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -283,20 +284,6 @@ void setCameraNative(const void *object, int type) {
|
||||
}
|
||||
}
|
||||
|
||||
void postCameraPoseEventNative(const void *object,
|
||||
float x, float y, float z, float qx, float qy, float qz, float qw, double stamp)
|
||||
{
|
||||
if(object)
|
||||
{
|
||||
native(object)->postCameraPoseEvent(x,y,z,qx,qy,qz,qw,stamp);
|
||||
}
|
||||
else
|
||||
{
|
||||
UERROR("object is null!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void postOdometryEventNative(const void *object,
|
||||
float x, float y, float z, float qx, float qy, float qz, float qw,
|
||||
float fx, float fy, float cx, float cy,
|
||||
@@ -312,7 +299,7 @@ void postOdometryEventNative(const void *object,
|
||||
if(object)
|
||||
{
|
||||
native(object)->postOdometryEvent(
|
||||
rtabmap::Transform(x,y,z,qx,qy,qz,qw),
|
||||
(qx==0.0f && qy==0.0f && qz==0.0f && qw==0.0f)?rtabmap::Transform():rtabmap::Transform(x,y,z,qx,qy,qz,qw),
|
||||
fx,fy,cx,cy, 0,0,0,0,
|
||||
rtabmap::Transform(), rtabmap::Transform(),
|
||||
stamp, 0,
|
||||
@@ -454,6 +441,13 @@ void setLocalizationModeNative(const void *object, bool enabled)
|
||||
else
|
||||
UERROR("object is null!");
|
||||
}
|
||||
void setDataRecorderModeNative(const void *object, bool enabled)
|
||||
{
|
||||
if(object)
|
||||
native(object)->setDataRecorderMode(enabled);
|
||||
else
|
||||
UERROR("object is null!");
|
||||
}
|
||||
void setTrajectoryModeNative(const void *object, bool enabled)
|
||||
{
|
||||
if(object)
|
||||
@@ -510,6 +504,13 @@ void setAppendModeNative(const void *object, bool enabled)
|
||||
else
|
||||
UERROR("object is null!");
|
||||
}
|
||||
void setUpstreamRelocalizationAccThrNative(const void * object, float value)
|
||||
{
|
||||
if(object)
|
||||
native(object)->setUpstreamRelocalizationAccThr(value);
|
||||
else
|
||||
UERROR("object is null!");
|
||||
}
|
||||
void setMaxCloudDepthNative(const void *object, float value)
|
||||
{
|
||||
if(object)
|
||||
@@ -587,6 +588,15 @@ void setDepthConfidenceNative(const void *object, int value)
|
||||
else
|
||||
UERROR("object is null!");
|
||||
}
|
||||
|
||||
void setExportPointCloudFormatNative(const void *object, const char * format)
|
||||
{
|
||||
if(object)
|
||||
native(object)->setExportPointCloudFormat(format);
|
||||
else
|
||||
UERROR("object is null!");
|
||||
}
|
||||
|
||||
int setMappingParameterNative(const void *object, const char * key, const char * value)
|
||||
{
|
||||
if(object)
|
||||
|
||||
@@ -29,7 +29,8 @@ void setupCallbacksNative(const void *object, void * classPtr,
|
||||
int,
|
||||
float, float, float, float,
|
||||
int, int,
|
||||
float, float, float, float, float, float));
|
||||
float, float, float, float, float, float),
|
||||
void(*cameraInfoEventCallback)(void *, int, const char*, const char*));
|
||||
void destroyNativeApplication(const void *object);
|
||||
void setScreenRotationNative(const void *object, int displayRotation);
|
||||
int openDatabaseNative(const void *object, const char * databasePath, bool databaseInMemory, bool optimize, bool clearDatabase);
|
||||
@@ -66,8 +67,6 @@ int renderNative(const void *object);
|
||||
bool startCameraNative(const void *object);
|
||||
void stopCameraNative(const void *object);
|
||||
void setCameraNative(const void *object, int type);
|
||||
void postCameraPoseEventNative(const void *object,
|
||||
float x, float y, float z, float qx, float qy, float qz, float qw, double stamp);
|
||||
void postOdometryEventNative(const void *object,
|
||||
float x, float y, float z, float qx, float qy, float qz, float qw,
|
||||
float fx, float fy, float cx, float cy,
|
||||
@@ -92,6 +91,7 @@ void setLightingNative(const void *object, bool enabled);
|
||||
void setBackfaceCullingNative(const void *object, bool enabled);
|
||||
void setWireframeNative(const void *object, bool enabled);
|
||||
void setLocalizationModeNative(const void *object, bool enabled);
|
||||
void setDataRecorderModeNative(const void *object, bool enabled);
|
||||
void setTrajectoryModeNative(const void *object, bool enabled);
|
||||
void setGraphOptimizationNative(const void *object, bool enabled);
|
||||
void setNodesFilteringNative(const void *object, bool enabled);
|
||||
@@ -100,6 +100,7 @@ void setGridVisibleNative(const void *object, bool visible);
|
||||
void setFullResolutionNative(const void *object, bool enabled);
|
||||
void setSmoothingNative(const void *object, bool enabled);
|
||||
void setAppendModeNative(const void *object, bool enabled);
|
||||
void setUpstreamRelocalizationAccThrNative(const void *object, float value);
|
||||
void setMaxCloudDepthNative(const void *object, float value);
|
||||
void setMinCloudDepthNative(const void *object, float value);
|
||||
void setCloudDensityLevelNative(const void *object, int value);
|
||||
@@ -111,6 +112,7 @@ void setMaxGainRadiusNative(const void *object, float value);
|
||||
void setRenderingTextureDecimationNative(const void *object, int value);
|
||||
void setBackgroundColorNative(const void *object, float gray);
|
||||
void setDepthConfidenceNative(const void *object, int value);
|
||||
void setExportPointCloudFormatNative(const void *object, const char * format);
|
||||
int setMappingParameterNative(const void *object, const char * key, const char * value);
|
||||
|
||||
typedef struct ImageNative
|
||||
|
||||
@@ -85,6 +85,25 @@ class RTABMap {
|
||||
|
||||
observer.statsUpdated(mySelf, nodes: Int(nodes), words: Int(words), points: Int(points), polygons: Int(polygons), updateTime: updateTime, loopClosureId: Int(loopClosureId), highestHypId: Int(highestHypId), databaseMemoryUsed: Int(databaseMemoryUsed), inliers: Int(inliers), matches: Int(matches), featuresExtracted: Int(featuresExtracted), hypothesis: hypothesis, nodesDrawn: Int(nodesDrawn), fps: fps, rejected: Int(rejected), rehearsalValue: rehearsalValue, optimizationMaxError: optimizationMaxError, optimizationMaxErrorRatio: optimizationMaxErrorRatio, distanceTravelled: distanceTravelled, fastMovement: Int(fastMovement), landmarkDetected: Int(landmarkDetected), x: x, y: y, z: z, roll: roll, pitch: pitch, yaw: yaw)
|
||||
}
|
||||
},
|
||||
//cameraInfoEventCallback
|
||||
{(observer, type, key, value) -> Void in
|
||||
// Extract pointer to `self` from void pointer:
|
||||
let mySelf = Unmanaged<RTABMap>.fromOpaque(observer!).takeUnretainedValue()
|
||||
// Call instance method:
|
||||
//mySelf.TestMethod();
|
||||
for (id, observation) in mySelf.observations {
|
||||
// If the observer is no longer in memory, we
|
||||
// can clean up the observation for its ID
|
||||
guard let observer = observation.observer else {
|
||||
mySelf.observations.removeValue(forKey: id)
|
||||
continue
|
||||
}
|
||||
|
||||
let strKey = String(cString: key!)
|
||||
let strValue = String(cString: value!)
|
||||
observer.cameraInfoEventReceived(mySelf, type: Int(type), key: strKey, value: strValue)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -215,21 +234,7 @@ class RTABMap {
|
||||
func setCamera(type: Int) {
|
||||
setCameraNative(native_rtabmap, Int32(type))
|
||||
}
|
||||
|
||||
func postCameraPoseEvent(pose: simd_float4x4, stamp: TimeInterval) {
|
||||
let rotation = GLKMatrix3(
|
||||
m: (pose[0,0], pose[0,1], pose[0,2],
|
||||
pose[1,0], pose[1,1], pose[1,2],
|
||||
pose[2,0], pose[2,1], pose[2,2]))
|
||||
let quat = GLKQuaternionMakeWithMatrix3(rotation)
|
||||
postCameraPoseEventNative(native_rtabmap, pose[3,0], pose[3,1], pose[3,2], quat.x, quat.y, quat.z, quat.w, stamp)
|
||||
}
|
||||
|
||||
func notifyLost() {
|
||||
// a null transform will make rtabmap creating a new session
|
||||
postCameraPoseEventNative(native_rtabmap, 0,0,0,0,0,0,0,0)
|
||||
}
|
||||
|
||||
|
||||
func postOdometryEvent(frame: ARFrame, orientation: UIInterfaceOrientation, viewport: CGSize) {
|
||||
let pose = frame.camera.transform // ViewMatrix
|
||||
let rotation = GLKMatrix3(
|
||||
@@ -239,12 +244,10 @@ class RTABMap {
|
||||
|
||||
let quat = GLKQuaternionMakeWithMatrix3(rotation)
|
||||
|
||||
postCameraPoseEventNative(native_rtabmap, pose[3,0], pose[3,1], pose[3,2], quat.x, quat.y, quat.z, quat.w, frame.timestamp)
|
||||
|
||||
let confMap = frame.sceneDepth?.confidenceMap
|
||||
let depthMap = frame.sceneDepth?.depthMap
|
||||
let points = frame.rawFeaturePoints?.points
|
||||
|
||||
|
||||
if points != nil && (depthMap != nil || points!.count>0)
|
||||
{
|
||||
let v = frame.camera.viewMatrix(for: orientation)
|
||||
@@ -313,9 +316,22 @@ class RTABMap {
|
||||
if(frame.lightEstimate != nil) {
|
||||
addEnvSensor(type: 4, value: Float(frame.lightEstimate!.ambientIntensity))
|
||||
}
|
||||
|
||||
|
||||
var lost = false
|
||||
switch frame.camera.trackingState {
|
||||
case .normal:
|
||||
lost = false
|
||||
case .limited(.excessiveMotion):
|
||||
lost = false
|
||||
case .limited(.insufficientFeatures):
|
||||
lost = false
|
||||
default:
|
||||
lost = true
|
||||
}
|
||||
// Notify lost with pose=null
|
||||
|
||||
postOdometryEventNative(native_rtabmap,
|
||||
pose[3,0], pose[3,1], pose[3,2], quat.x, quat.y, quat.z, quat.w,
|
||||
!lost ? pose[3,0]:0, !lost ? pose[3,1]:0, !lost ? pose[3,2]:0, !lost ? quat.x:0, !lost ? quat.y:0, !lost ? quat.z:0, !lost ? quat.w:0,
|
||||
frame.camera.intrinsics[0,0], // fx
|
||||
frame.camera.intrinsics[1,1], // fy
|
||||
frame.camera.intrinsics[2,0], // cx
|
||||
@@ -390,8 +406,8 @@ class RTABMap {
|
||||
func setLocalizationMode(enabled: Bool) {
|
||||
setLocalizationModeNative(native_rtabmap, enabled)
|
||||
}
|
||||
func setTrajectoryMode(enabled: Bool) {
|
||||
setTrajectoryModeNative(native_rtabmap, enabled)
|
||||
func setDataRecorderMode(enabled: Bool) {
|
||||
setDataRecorderModeNative(native_rtabmap, enabled)
|
||||
}
|
||||
func setGraphOptimization(enabled: Bool) {
|
||||
setGraphOptimizationNative(native_rtabmap, enabled)
|
||||
@@ -414,6 +430,9 @@ class RTABMap {
|
||||
func setAppendMode(enabled: Bool) {
|
||||
setAppendModeNative(native_rtabmap, enabled)
|
||||
}
|
||||
func setUpstreamRelocalizationAccThr(value: Float) {
|
||||
setUpstreamRelocalizationAccThrNative(native_rtabmap, value)
|
||||
}
|
||||
func setMaxCloudDepth(value: Float) {
|
||||
setMaxCloudDepthNative(native_rtabmap, value)
|
||||
}
|
||||
@@ -447,6 +466,11 @@ class RTABMap {
|
||||
func setDepthConfidence(value: Int) {
|
||||
setDepthConfidenceNative(native_rtabmap, Int32(value))
|
||||
}
|
||||
func setExportPointCloudFormat(format: String) {
|
||||
format.utf8CString.withUnsafeBufferPointer { bufferFormat in
|
||||
return setExportPointCloudFormatNative(native_rtabmap, bufferFormat.baseAddress)
|
||||
}
|
||||
}
|
||||
func setMappingParameter(key: String, value: String) {
|
||||
key.utf8CString.withUnsafeBufferPointer { bufferKey in
|
||||
value.utf8CString.withUnsafeBufferPointer { bufferValue in
|
||||
@@ -523,6 +547,7 @@ protocol RTABMapObserver: class {
|
||||
roll: Float,
|
||||
pitch: Float,
|
||||
yaw: Float)
|
||||
func cameraInfoEventReceived(_ rtabmap: RTABMap, type: Int, key: String, value: String)
|
||||
}
|
||||
|
||||
extension String {
|
||||
|
||||
@@ -41,6 +41,7 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
private var mTimeThr: Int = 0
|
||||
private var mMaxFeatures: Int = 0
|
||||
private var mLoopThr = 0.11
|
||||
private var mDataRecording = false
|
||||
|
||||
private var mReviewRequested = false
|
||||
|
||||
@@ -63,7 +64,7 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
case .STATE_CAMERA:
|
||||
return "Camera Preview"
|
||||
case .STATE_MAPPING:
|
||||
return "Mapping"
|
||||
return mDataRecording ? "Data Recording" : "Mapping"
|
||||
case .STATE_PROCESSING:
|
||||
return "Processing"
|
||||
case .STATE_VISUALIZING:
|
||||
@@ -428,6 +429,16 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
}
|
||||
}
|
||||
|
||||
func cameraInfoEventReceived(_ rtabmap: RTABMap, type: Int, key: String, value: String) {
|
||||
if(self.debugShown && key == "UpstreamRelocationFiltered")
|
||||
{
|
||||
DispatchQueue.main.async {
|
||||
self.dismiss(animated: true)
|
||||
self.showToast(message: "ARKit re-localization filtered because an acceleration of \(value) has been detected, which is over current threshold set in the settings.", seconds: 3)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func getMemoryUsage() -> UInt64 {
|
||||
var taskInfo = mach_task_basic_info()
|
||||
var count = mach_msg_type_number_t(MemoryLayout<mach_task_basic_info>.size)/4
|
||||
@@ -460,7 +471,7 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
if(mMapNodes > 0 && self.openedDatabasePath == nil)
|
||||
{
|
||||
let msg = "RTAB-Map has been pushed to background while mapping. Do you want to save the map now?"
|
||||
let alert = UIAlertController(title: "Mapping Stopped!", message: msg, preferredStyle: .alert)
|
||||
let alert = UIAlertController(title: mDataRecording ? "Data Recording Stopped" : "Mapping Stopped!", message: msg, preferredStyle: .alert)
|
||||
let alertActionNo = UIAlertAction(title: "Ignore", style: .cancel) {
|
||||
(UIAlertAction) -> Void in
|
||||
}
|
||||
@@ -582,6 +593,7 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
mState = state;
|
||||
|
||||
var actionNewScanEnabled: Bool
|
||||
var actionNewDataRecording: Bool
|
||||
var actionSaveEnabled: Bool
|
||||
var actionResumeEnabled: Bool
|
||||
var actionExportEnabled: Bool
|
||||
@@ -602,7 +614,8 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
exportOBJPLYButton.isHidden = true
|
||||
orthoDistanceSlider.isHidden = cameraMode != 3
|
||||
orthoGridSlider.isHidden = cameraMode != 3
|
||||
actionNewScanEnabled = true
|
||||
actionNewScanEnabled = !mDataRecording
|
||||
actionNewDataRecording = mDataRecording
|
||||
actionSaveEnabled = false
|
||||
actionResumeEnabled = false
|
||||
actionExportEnabled = false
|
||||
@@ -621,7 +634,8 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
exportOBJPLYButton.isHidden = true
|
||||
orthoDistanceSlider.isHidden = cameraMode != 3 || !mHudVisible
|
||||
orthoGridSlider.isHidden = cameraMode != 3 || !mHudVisible
|
||||
actionNewScanEnabled = true
|
||||
actionNewScanEnabled = !mDataRecording
|
||||
actionNewDataRecording = mDataRecording
|
||||
actionSaveEnabled = false
|
||||
actionResumeEnabled = false
|
||||
actionExportEnabled = false
|
||||
@@ -643,6 +657,7 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
orthoDistanceSlider.isHidden = cameraMode != 3 || mState != .STATE_VISUALIZING_WHILE_LOADING
|
||||
orthoGridSlider.isHidden = cameraMode != 3 || mState != .STATE_VISUALIZING_WHILE_LOADING
|
||||
actionNewScanEnabled = false
|
||||
actionNewDataRecording = false
|
||||
actionSaveEnabled = false
|
||||
actionResumeEnabled = false
|
||||
actionExportEnabled = false
|
||||
@@ -662,6 +677,7 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
orthoDistanceSlider.isHidden = cameraMode != 3 || !mHudVisible
|
||||
orthoGridSlider.isHidden = cameraMode != 3 || !mHudVisible
|
||||
actionNewScanEnabled = true
|
||||
actionNewDataRecording = true
|
||||
actionSaveEnabled = mMapNodes>0
|
||||
actionResumeEnabled = mMapNodes>0
|
||||
actionExportEnabled = mMapNodes>0
|
||||
@@ -681,6 +697,7 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
orthoDistanceSlider.isHidden = cameraMode != 3 || !mHudVisible
|
||||
orthoGridSlider.isHidden = cameraMode != 3 || !mHudVisible
|
||||
actionNewScanEnabled = true
|
||||
actionNewDataRecording = true
|
||||
actionSaveEnabled = mState != .STATE_WELCOME && mMapNodes>0
|
||||
actionResumeEnabled = mState != .STATE_WELCOME && mMapNodes>0
|
||||
actionExportEnabled = mState != .STATE_WELCOME && mMapNodes>0
|
||||
@@ -762,9 +779,16 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
self.optimization(approach: -1)
|
||||
}),
|
||||
optimizeAdvancedMenu])
|
||||
|
||||
// Advanced menu
|
||||
let advancedMenu = UIMenu(title: "Advanced...", children: [
|
||||
UIAction(title: "New Data Recording", image: UIImage(systemName: "plus.app"), attributes: actionNewDataRecording ? [] : .disabled, state: .off, handler: { _ in
|
||||
self.newScan(dataRecordingMode: true)
|
||||
})
|
||||
])
|
||||
|
||||
var fileMenuChildren: [UIMenuElement] = []
|
||||
fileMenuChildren.append(UIAction(title: "New Scan", image: UIImage(systemName: "plus.app"), attributes: actionNewScanEnabled ? [] : .disabled, state: .off, handler: { _ in
|
||||
fileMenuChildren.append(UIAction(title: "New Mapping Session", image: UIImage(systemName: "plus.app"), attributes: actionNewScanEnabled ? [] : .disabled, state: .off, handler: { _ in
|
||||
self.newScan()
|
||||
}))
|
||||
if(actionOptimizeEnabled) {
|
||||
@@ -787,6 +811,7 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
fileMenuChildren.append(UIAction(title: "Append Scan", image: UIImage(systemName: "play.fill"), attributes: actionResumeEnabled ? [] : .disabled, state: .off, handler: { _ in
|
||||
self.resumeScan()
|
||||
}))
|
||||
fileMenuChildren.append(advancedMenu)
|
||||
|
||||
// File menu
|
||||
let fileMenu = UIMenu(title: "File", options: .displayInline, children: fileMenuChildren)
|
||||
@@ -1001,16 +1026,9 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
status = "Camera Is Occluded Or Lighting Is Too Dark"
|
||||
}
|
||||
|
||||
if accept
|
||||
if let rotation = UIApplication.shared.windows.first?.windowScene?.interfaceOrientation
|
||||
{
|
||||
if let rotation = UIApplication.shared.windows.first?.windowScene?.interfaceOrientation
|
||||
{
|
||||
rtabmap?.postOdometryEvent(frame: frame, orientation: rotation, viewport: self.view.frame.size)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rtabmap?.notifyLost();
|
||||
rtabmap?.postOdometryEvent(frame: frame, orientation: rotation, viewport: self.view.frame.size)
|
||||
}
|
||||
|
||||
if !status.isEmpty {
|
||||
@@ -1292,7 +1310,7 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
}
|
||||
|
||||
@IBAction func singleTapped(_ gestureRecognizer: UITapGestureRecognizer) {
|
||||
if gestureRecognizer.state == UIGestureRecognizer.State.recognized
|
||||
if gestureRecognizer.state == .recognized
|
||||
{
|
||||
resetNoTouchTimer(!mHudVisible)
|
||||
|
||||
@@ -1322,6 +1340,8 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
rtabmap!.setFullResolution(enabled: defaults.bool(forKey: "HDMode"));
|
||||
rtabmap!.setSmoothing(enabled: defaults.bool(forKey: "Smoothing"));
|
||||
rtabmap!.setAppendMode(enabled: defaults.bool(forKey: "AppendMode"));
|
||||
rtabmap!.setUpstreamRelocalizationAccThr(value: defaults.float(forKey: "UpstreamRelocalizationFilteringAccThr"));
|
||||
rtabmap!.setExportPointCloudFormat(format: defaults.string(forKey: "ExportPointCloudFormat")!);
|
||||
|
||||
mTimeThr = (defaults.string(forKey: "TimeLimit")! as NSString).integerValue
|
||||
mMaxFeatures = (defaults.string(forKey: "MaxFeaturesExtractedLoopClosure")! as NSString).integerValue
|
||||
@@ -1379,8 +1399,10 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
let bgColor = defaults.float(forKey: "BackgroundColor");
|
||||
rtabmap!.setBackgroundColor(gray: bgColor);
|
||||
|
||||
let format = defaults.string(forKey: "ExportPointCloudFormat")!;
|
||||
DispatchQueue.main.async {
|
||||
self.statusLabel.textColor = bgColor>=0.6 ? UIColor(white: 0.0, alpha: 1) : UIColor(white: 1.0, alpha: 1)
|
||||
self.exportOBJPLYButton.setTitle("Export OBJ-\(format == "las" ? "LAS" : "PLY")", for: .normal)
|
||||
}
|
||||
|
||||
rtabmap!.setClusterRatio(value: defaults.float(forKey: "NoiseFilteringRatio"));
|
||||
@@ -1409,22 +1431,24 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
rtabmap!.postExportation(visualize: false)
|
||||
}
|
||||
|
||||
let alertController = UIAlertController(title: "Append Mode", message: "The camera preview will not be aligned to map on start, move to a previously scanned area, then push Record. When a loop closure is detected, new scans will be appended to map.", preferredStyle: .alert)
|
||||
|
||||
let okAction = UIAlertAction(title: "OK", style: .default) { (action) in
|
||||
if(!mDataRecording) {
|
||||
let alertController = UIAlertController(title: "Append Mode", message: "The camera preview will not be aligned to map on start, move to a previously scanned area, then push Record. When a loop closure is detected, new scans will be appended to map.", preferredStyle: .alert)
|
||||
|
||||
let okAction = UIAlertAction(title: "OK", style: .default) { (action) in
|
||||
}
|
||||
alertController.addAction(okAction)
|
||||
|
||||
present(alertController, animated: true)
|
||||
}
|
||||
alertController.addAction(okAction)
|
||||
|
||||
present(alertController, animated: true)
|
||||
|
||||
setGLCamera(type: 0);
|
||||
startCamera();
|
||||
}
|
||||
|
||||
func newScan()
|
||||
func newScan(dataRecordingMode: Bool = false)
|
||||
{
|
||||
print("databases.size() = \(databases.size())")
|
||||
if(databases.count >= 5 && !mReviewRequested && self.depthSupported)
|
||||
if(databases.count >= 10 && !mReviewRequested && self.depthSupported)
|
||||
{
|
||||
SKStoreReviewController.requestReviewInCurrentScene()
|
||||
mReviewRequested = true
|
||||
@@ -1438,7 +1462,6 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
mMapNodes = 0;
|
||||
self.openedDatabasePath = nil
|
||||
let tmpDatabase = self.getDocumentDirectory().appendingPathComponent(self.RTABMAP_TMP_DB)
|
||||
let inMemory = UserDefaults.standard.bool(forKey: "DatabaseInMemory")
|
||||
if(!(self.mState == State.STATE_CAMERA || self.mState == State.STATE_MAPPING) &&
|
||||
FileManager.default.fileExists(atPath: tmpDatabase.path) &&
|
||||
tmpDatabase.fileSize > 1024*1024) // > 1MB
|
||||
@@ -1454,7 +1477,7 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
catch {
|
||||
print("Could not clear tmp database: \(error)")
|
||||
}
|
||||
self.newScan()
|
||||
self.newScan(dataRecordingMode: dataRecordingMode)
|
||||
}
|
||||
alert.addAction(alertActionNo)
|
||||
let alertActionCancel = UIAlertAction(title: "Cancel", style: .cancel) {
|
||||
@@ -1545,10 +1568,25 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
}
|
||||
else
|
||||
{
|
||||
let inMemory = UserDefaults.standard.bool(forKey: "DatabaseInMemory") && !dataRecordingMode
|
||||
mDataRecording = dataRecordingMode
|
||||
self.rtabmap!.setDataRecorderMode(enabled: dataRecordingMode)
|
||||
self.optimizedGraphShown = true // Always reset to true when opening a database
|
||||
self.rtabmap!.openDatabase(databasePath: tmpDatabase.path, databaseInMemory: inMemory, optimize: false, clearDatabase: true)
|
||||
|
||||
|
||||
if(!(self.mState == State.STATE_CAMERA || self.mState == State.STATE_MAPPING))
|
||||
{
|
||||
if(mDataRecording) {
|
||||
let alertController = UIAlertController(title: "Data Recording Mode", message: "This mode should be only used if you want to record raw ARKit data as long as possible without any feedback: loop closure detection and map rendering are disabled. The database size in Debug display shows how much data has been recorded so far.", preferredStyle: .alert)
|
||||
|
||||
let okAction = UIAlertAction(title: "OK", style: .default) { (action) in
|
||||
}
|
||||
alertController.addAction(okAction)
|
||||
|
||||
present(alertController, animated: true)
|
||||
self.debugShown = true
|
||||
}
|
||||
|
||||
self.setGLCamera(type: 0);
|
||||
self.startCamera();
|
||||
}
|
||||
@@ -1575,6 +1613,9 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
alert.addAction(yes)
|
||||
let no = UIAlertAction(title: "No", style: .cancel) {
|
||||
(UIAlertAction) -> Void in
|
||||
if(self.mDataRecording) {
|
||||
self.save() // We cannot skip saving after data recording
|
||||
}
|
||||
}
|
||||
alert.addAction(no)
|
||||
|
||||
@@ -1583,10 +1624,17 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
self.saveDatabase(fileName: fileName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
self.save()
|
||||
}
|
||||
}
|
||||
|
||||
//Step : 3
|
||||
var placeholder = Date().getFormattedDate(format: "yyMMdd-HHmmss")
|
||||
if(mDataRecording) {
|
||||
placeholder += "-recording"
|
||||
}
|
||||
if self.openedDatabasePath != nil && !self.openedDatabasePath!.path.isEmpty
|
||||
{
|
||||
var components = self.openedDatabasePath!.lastPathComponent.components(separatedBy: ".")
|
||||
@@ -1604,7 +1652,9 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
//Step : 4
|
||||
alert.addAction(save)
|
||||
//Cancel action
|
||||
alert.addAction(UIAlertAction(title: "Cancel", style: .default) { (alertAction) in })
|
||||
if(!mDataRecording) {
|
||||
alert.addAction(UIAlertAction(title: "Cancel", style: .default) { (alertAction) in })
|
||||
}
|
||||
|
||||
self.present(alert, animated: true) {
|
||||
alert.textFields?.first?.selectAll(nil)
|
||||
@@ -1649,7 +1699,7 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
print("Could not clear tmp database: \(error)")
|
||||
}
|
||||
self.updateDatabases()
|
||||
self.updateState(state: previousState)
|
||||
self.updateState(state: self.mDataRecording ? .STATE_WELCOME : previousState)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1854,6 +1904,10 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
locationManager?.stopUpdatingLocation()
|
||||
rtabmap?.setPausedMapping(paused: true)
|
||||
rtabmap?.stopCamera()
|
||||
if(mDataRecording) {
|
||||
// this will show the trajectory before saving
|
||||
self.rtabmap!.setGraphOptimization(enabled: false)
|
||||
}
|
||||
setGLCamera(type: 2)
|
||||
if(mState == .STATE_VISUALIZING_CAMERA)
|
||||
{
|
||||
@@ -1863,34 +1917,42 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
|
||||
if !ignoreSaving
|
||||
{
|
||||
dismiss(animated: true, completion: {
|
||||
var msg = "Do you want to do standard graph optimization and make a nice assembled mesh now? This can be also done later using \"Optimize\" and \"Assemble\" menus."
|
||||
let depthUsed = self.depthSupported && UserDefaults.standard.bool(forKey: "LidarMode")
|
||||
if !depthUsed
|
||||
{
|
||||
msg = "Do you want to do standard graph optimization now? This can be also done later using \"Optimize\" menu."
|
||||
}
|
||||
let alert = UIAlertController(title: "Mapping Stopped! Optimize Now?", message: msg, preferredStyle: .alert)
|
||||
if depthUsed {
|
||||
let alertActionOnlyGraph = UIAlertAction(title: "Only Optimize", style: .default)
|
||||
if(mDataRecording)
|
||||
{
|
||||
// Go directly to save
|
||||
self.save()
|
||||
}
|
||||
else
|
||||
{
|
||||
dismiss(animated: true, completion: {
|
||||
var msg = "Do you want to do standard graph optimization and make a nice assembled mesh now? This can be also done later using \"Optimize\" and \"Assemble\" menus."
|
||||
let depthUsed = self.depthSupported && UserDefaults.standard.bool(forKey: "LidarMode")
|
||||
if !depthUsed
|
||||
{
|
||||
(UIAlertAction) -> Void in
|
||||
self.optimization(withStandardMeshExport: false, approach: -1)
|
||||
msg = "Do you want to do standard graph optimization now? This can be also done later using \"Optimize\" menu."
|
||||
}
|
||||
alert.addAction(alertActionOnlyGraph)
|
||||
}
|
||||
let alertActionNo = UIAlertAction(title: "Save First", style: .cancel) {
|
||||
(UIAlertAction) -> Void in
|
||||
self.save()
|
||||
}
|
||||
alert.addAction(alertActionNo)
|
||||
let alertActionYes = UIAlertAction(title: "Yes", style: .default) {
|
||||
(UIAlertAction) -> Void in
|
||||
self.optimization(withStandardMeshExport: depthUsed, approach: -1)
|
||||
}
|
||||
alert.addAction(alertActionYes)
|
||||
self.present(alert, animated: true, completion: nil)
|
||||
})
|
||||
let alert = UIAlertController(title: "Mapping Stopped! Optimize Now?", message: msg, preferredStyle: .alert)
|
||||
if depthUsed {
|
||||
let alertActionOnlyGraph = UIAlertAction(title: "Only Optimize", style: .default)
|
||||
{
|
||||
(UIAlertAction) -> Void in
|
||||
self.optimization(withStandardMeshExport: false, approach: -1)
|
||||
}
|
||||
alert.addAction(alertActionOnlyGraph)
|
||||
}
|
||||
let alertActionNo = UIAlertAction(title: "Save First", style: .cancel) {
|
||||
(UIAlertAction) -> Void in
|
||||
self.save()
|
||||
}
|
||||
alert.addAction(alertActionNo)
|
||||
let alertActionYes = UIAlertAction(title: "Yes", style: .default) {
|
||||
(UIAlertAction) -> Void in
|
||||
self.optimization(withStandardMeshExport: depthUsed, approach: -1)
|
||||
}
|
||||
alert.addAction(alertActionYes)
|
||||
self.present(alert, animated: true, completion: nil)
|
||||
})
|
||||
}
|
||||
}
|
||||
else if(mMapNodes == 0)
|
||||
{
|
||||
@@ -1937,6 +1999,7 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
|
||||
updateState(state: .STATE_PROCESSING);
|
||||
var status = 0
|
||||
DispatchQueue.background(background: {
|
||||
self.optimizedGraphShown = true // Always reset to true when opening a database
|
||||
status = self.rtabmap!.openDatabase(databasePath: self.openedDatabasePath!.path, databaseInMemory: true, optimize: false, clearDatabase: false)
|
||||
}, completion:{
|
||||
// main thread
|
||||
|
||||
@@ -4,17 +4,13 @@ set -euxo pipefail
|
||||
|
||||
# Tested on Apple Silicon Mac, with cmake 3.19.2.
|
||||
|
||||
mkdir Libraries
|
||||
mkdir -p Libraries
|
||||
cd Libraries
|
||||
pwd=$(pwd)
|
||||
prefix=$pwd
|
||||
sysroot=iphoneos
|
||||
#sysroot=iphonesimulator
|
||||
|
||||
|
||||
# Install directory for all dependencies
|
||||
mkdir -p $prefix
|
||||
|
||||
# openmp
|
||||
# based on https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/libomp.rb
|
||||
#curl -L https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/openmp-11.1.0.src.tar.xz -o openmp-11.1.0.src.tar.xz
|
||||
@@ -30,41 +26,60 @@ mkdir -p $prefix
|
||||
#cmake --build . --config Release --target install -- CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED="NO" CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO"
|
||||
|
||||
# Boost
|
||||
echo "wget boost..."
|
||||
curl -L https://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz -o boost_1_59_0.tar.gz
|
||||
tar -xzf boost_1_59_0.tar.gz
|
||||
if [ ! -e $prefix/include/boost ]
|
||||
then
|
||||
if [ ! -e boost_1_59_0 ]
|
||||
then
|
||||
echo "wget boost..."
|
||||
curl -L https://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz -o boost_1_59_0.tar.gz
|
||||
tar -xzf boost_1_59_0.tar.gz
|
||||
fi
|
||||
cd boost_1_59_0
|
||||
curl -L https://gist.github.com/matlabbe/0bce8feeb73a499a76afbbcc5c687221/raw/489ff2869eccd6f8d03ffb9090ef839108762741/BoostConfig.cmake.in -o BoostConfig.cmake.in
|
||||
curl -L https://gist.github.com/matlabbe/0bce8feeb73a499a76afbbcc5c687221/raw/b07fe7d4e5dfe5f1d110c733e5cf660d79a26378/CMakeLists.txt -o CMakeLists.txt
|
||||
mkdir build
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_SYSROOT=$sysroot -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 -DCMAKE_INSTALL_PREFIX=$prefix ..
|
||||
cmake --build . --config Release
|
||||
cmake --build . --config Release --target install
|
||||
cd $pwd
|
||||
#rm -r boost_1_59_0.tar.gz boost_1_59_0
|
||||
fi
|
||||
|
||||
# eigen
|
||||
echo "wget eigen..."
|
||||
curl -L https://gitlab.com/libeigen/eigen/-/archive/3.3.9/eigen-3.3.9.tar.gz -o 3.3.9.tar.gz
|
||||
tar -xzf 3.3.9.tar.gz
|
||||
if [ ! -e $prefix/include/eigen3 ]
|
||||
then
|
||||
if [ ! -e eigen-3.3.9 ]
|
||||
then
|
||||
echo "wget eigen..."
|
||||
curl -L https://gitlab.com/libeigen/eigen/-/archive/3.3.9/eigen-3.3.9.tar.gz -o 3.3.9.tar.gz
|
||||
tar -xzf 3.3.9.tar.gz
|
||||
fi
|
||||
cd eigen-3.3.9
|
||||
mkdir build
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_SYSROOT=$sysroot -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 -DCMAKE_INSTALL_PREFIX=$prefix ..
|
||||
cmake --build . --config Release
|
||||
cmake --build . --config Release --target install
|
||||
cd $pwd
|
||||
#rm -r 3.3.9.tar.gz eigen-3.3.9
|
||||
fi
|
||||
|
||||
# FLANN
|
||||
echo "wget flann..."
|
||||
git clone https://github.com/flann-lib/flann.git
|
||||
if [ ! -e $prefix/include/flann ]
|
||||
then
|
||||
if [ ! -e flann ]
|
||||
then
|
||||
echo "wget flann..."
|
||||
git clone https://github.com/flann-lib/flann.git -b 1.8.4
|
||||
fi
|
||||
cd flann
|
||||
git checkout 1.8.4
|
||||
curl -L https://gist.githubusercontent.com/matlabbe/c858ba36fb85d5e44d8667dfb3543e12/raw/8fc40aa9bc3267604869444020476a49f14ab424/flann_ios.patch -o flann_ios.patch
|
||||
git apply flann_ios.patch
|
||||
mkdir build
|
||||
if [ ! -e flann_ios.patch ]
|
||||
then
|
||||
curl -L https://gist.githubusercontent.com/matlabbe/c858ba36fb85d5e44d8667dfb3543e12/raw/8fc40aa9bc3267604869444020476a49f14ab424/flann_ios.patch -o flann_ios.patch
|
||||
git apply flann_ios.patch
|
||||
fi
|
||||
mkdir -p build
|
||||
cd build
|
||||
# comment "add_subdirectory( test )" in top CMakeLists.txt
|
||||
# comment "add_subdirectory( doc )" in top CMakeLists.txt
|
||||
@@ -73,76 +88,131 @@ cmake --build . --config Release -- CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=
|
||||
cmake --build . --config Release --target install -- CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED="NO" CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO"
|
||||
cd $pwd
|
||||
#rm -r flann
|
||||
fi
|
||||
|
||||
# GTSAM
|
||||
git clone https://bitbucket.org/gtborg/gtsam.git
|
||||
cd gtsam
|
||||
git checkout fbb9d3bdda8b88df51896bc401bfd170573e66f5
|
||||
if [ ! -e $prefix/include/gtsam ]
|
||||
then
|
||||
if [ ! -e gtsam ]
|
||||
then
|
||||
git clone https://bitbucket.org/gtborg/gtsam.git
|
||||
cd gtsam
|
||||
git checkout fbb9d3bdda8b88df51896bc401bfd170573e66f5
|
||||
else
|
||||
cd gtsam
|
||||
fi
|
||||
# patch
|
||||
curl -L https://gist.github.com/matlabbe/76d658dddb841b3355ae3a6e32850cd8/raw/7033cba1c89097b0c830651d7277c04dc92cbdd9/gtsam_GKlib_ios_fix.patch -o gtsam_GKlib_ios_fix.patch
|
||||
git apply gtsam_GKlib_ios_fix.patch
|
||||
mkdir build
|
||||
if [ ! -e gtsam_GKlib_ios_fix.patch ]
|
||||
then
|
||||
curl -L https://gist.github.com/matlabbe/76d658dddb841b3355ae3a6e32850cd8/raw/7033cba1c89097b0c830651d7277c04dc92cbdd9/gtsam_GKlib_ios_fix.patch -o gtsam_GKlib_ios_fix.patch
|
||||
git apply gtsam_GKlib_ios_fix.patch
|
||||
fi
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_SYSROOT=$sysroot -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 -DCMAKE_INSTALL_PREFIX=$prefix -DMETIS_SHARED=OFF -DGTSAM_BUILD_STATIC_LIBRARY=ON -DGTSAM_BUILD_TESTS=OFF -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF -DGTSAM_USE_SYSTEM_EIGEN=ON -DGTSAM_WRAP_SERIALIZATION=OFF -DGTSAM_BUILD_WRAP=OFF -DGTSAM_INSTALL_CPPUNITLITE=OFF -DCMAKE_FIND_ROOT_PATH=$prefix ..
|
||||
cmake --build . --config Release -- CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED="NO" CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO"
|
||||
cmake --build . --config Release --target install -- CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED="NO" CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO"
|
||||
cd $pwd
|
||||
#rm -rf gtsam
|
||||
fi
|
||||
|
||||
# g2o
|
||||
git clone https://github.com/RainerKuemmerle/g2o.git
|
||||
cd g2o
|
||||
git checkout a3f7706bdbb849b2808dc3e1b7aee189f63b498e
|
||||
if [ ! -e $prefix/include/g2o ]
|
||||
then
|
||||
if [ ! -e g2o ]
|
||||
then
|
||||
git clone https://github.com/RainerKuemmerle/g2o.git
|
||||
cd g2o
|
||||
git checkout a3f7706bdbb849b2808dc3e1b7aee189f63b498e
|
||||
else
|
||||
cd g2o
|
||||
fi
|
||||
# patch
|
||||
curl -L https://gist.github.com/matlabbe/b9ccfeae8f0744b275cab23510872680/raw/a58e06accba3976420d4b61341685c123193810e/g2o_ios_fix.patch -o g2o_ios_fix.patch
|
||||
git apply g2o_ios_fix.patch
|
||||
mkdir build
|
||||
if [ ! -e g2o_ios_fix.patch ]
|
||||
then
|
||||
curl -L https://gist.github.com/matlabbe/b9ccfeae8f0744b275cab23510872680/raw/a58e06accba3976420d4b61341685c123193810e/g2o_ios_fix.patch -o g2o_ios_fix.patch
|
||||
git apply g2o_ios_fix.patch
|
||||
fi
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_SYSROOT=$sysroot -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 -DCMAKE_INSTALL_PREFIX=$prefix -DBUILD_LGPL_SHARED_LIBS=OFF -DG2O_BUILD_APPS=OFF -DG2O_BUILD_EXAMPLES=OFF -DCMAKE_FIND_ROOT_PATH=$prefix ..
|
||||
cmake --build . --config Release -- CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED="NO" CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO"
|
||||
cmake --build . --config Release --target install -- CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED="NO" CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO"
|
||||
cd $pwd
|
||||
#rm -rf g2o
|
||||
fi
|
||||
|
||||
# VTK
|
||||
git clone https://github.com/Kitware/VTK.git
|
||||
cd VTK
|
||||
git checkout tags/v8.2.0
|
||||
if [ ! -e $prefix/lib/vtk.framework ]
|
||||
then
|
||||
if [ ! -e VTK ]
|
||||
then
|
||||
git clone https://github.com/Kitware/VTK.git
|
||||
cd VTK
|
||||
git checkout tags/v8.2.0
|
||||
else
|
||||
cd VTK
|
||||
fi
|
||||
git cherry-pick bf3ae8072df2393c7270509bae41be0776826346
|
||||
mkdir build
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_FRAMEWORK_INSTALL_PREFIX=$prefix/lib -DIOS_DEVICE_ARCHITECTURES="arm64" -DIOS_SIMULATOR_ARCHITECTURES="" -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DVTK_IOS_BUILD=ON -DModule_vtkFiltersModeling=ON ..
|
||||
# For iphonesimulator: add -DIOS_DEVICE_ARCHITECTURES=""
|
||||
cmake --build . --config Release
|
||||
cd $pwd
|
||||
#rm -rf VTK
|
||||
fi
|
||||
|
||||
# PCL
|
||||
git clone https://github.com/PointCloudLibrary/pcl.git
|
||||
cd pcl
|
||||
git checkout tags/pcl-1.11.1
|
||||
if [ ! -e $prefix/include/pcl-1.11 ]
|
||||
then
|
||||
if [ ! -e pcl ]
|
||||
then
|
||||
git clone https://github.com/PointCloudLibrary/pcl.git
|
||||
cd pcl
|
||||
git checkout tags/pcl-1.11.1
|
||||
else
|
||||
cd pcl
|
||||
fi
|
||||
# patch
|
||||
curl -L https://gist.github.com/matlabbe/f3ba9366eb91e1b855dadd2ddce5746d/raw/6869cf26211ab15492599e557b0e729b23b2c119/pcl_1_11_1_vtk_ios_support.patch -o pcl_1_11_1_vtk_ios_support.patch
|
||||
git apply pcl_1_11_1_vtk_ios_support.patch
|
||||
mkdir build
|
||||
if [ ! -e pcl_1_11_1_vtk_ios_support.patch ]
|
||||
then
|
||||
curl -L https://gist.github.com/matlabbe/f3ba9366eb91e1b855dadd2ddce5746d/raw/6869cf26211ab15492599e557b0e729b23b2c119/pcl_1_11_1_vtk_ios_support.patch -o pcl_1_11_1_vtk_ios_support.patch
|
||||
git apply pcl_1_11_1_vtk_ios_support.patch
|
||||
fi
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_SYSROOT=$sysroot -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 -DCMAKE_INSTALL_PREFIX=$prefix -DBUILD_apps=OFF -DBUILD_examples=OFF -DBUILD_tools=OFF -DBUILD_visualization=OFF -DBUILD_tracking=OFF -DBUILD_people=OFF -DBUILD_global_tests=OFF -DWITH_QT=OFF -DWITH_OPENGL=OFF -DWITH_VTK=ON -DPCL_SHARED_LIBS=OFF -DPCL_ENABLE_SSE=OFF -DCMAKE_FIND_ROOT_PATH=$prefix ..
|
||||
cmake --build . --config Release
|
||||
cmake --build . --config Release --target install
|
||||
cd $pwd
|
||||
#rm -rf pcl
|
||||
fi
|
||||
|
||||
# OpenCV
|
||||
git clone https://github.com/opencv/opencv_contrib.git
|
||||
cd opencv_contrib
|
||||
git checkout tags/3.4.2
|
||||
if [ ! -e $prefix/include/opencv2 ]
|
||||
then
|
||||
if [ ! -e opencv_contrib ]
|
||||
then
|
||||
git clone https://github.com/opencv/opencv_contrib.git
|
||||
cd opencv_contrib
|
||||
git checkout tags/3.4.2
|
||||
fi
|
||||
cd $pwd
|
||||
git clone https://github.com/opencv/opencv.git
|
||||
cd opencv
|
||||
git checkout tags/3.4.2
|
||||
curl -L https://gist.githubusercontent.com/matlabbe/fdc3ab4854f3a68fbde7277f543b4e5b/raw/f340839c09165056d3845645df24b76507542fd2/opencv_ios.patch -o opencv_ios.patch
|
||||
git apply opencv_ios.patch
|
||||
mkdir build
|
||||
if [ ! -e opencv ]
|
||||
then
|
||||
git clone https://github.com/opencv/opencv.git
|
||||
cd opencv
|
||||
git checkout tags/3.4.2
|
||||
else
|
||||
cd opencv
|
||||
fi
|
||||
if [ ! -e opencv_ios.patch ]
|
||||
then
|
||||
curl -L https://gist.githubusercontent.com/matlabbe/fdc3ab4854f3a68fbde7277f543b4e5b/raw/f340839c09165056d3845645df24b76507542fd2/opencv_ios.patch -o opencv_ios.patch
|
||||
git apply opencv_ios.patch
|
||||
fi
|
||||
mkdir -p build
|
||||
cd build
|
||||
# add "add_definitions(-DPNG_ARM_NEON_OPT=0)" in 3rdparty/libpng/CMakeLists.txt
|
||||
cmake -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_SYSROOT=$sysroot -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 -DCMAKE_INSTALL_PREFIX=$prefix -DOPENCV_EXTRA_MODULES_PATH=$prefix/opencv_contrib/modules -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DWITH_CUDA=OFF -DBUILD_opencv_apps=OFF -DBUILD_opencv_xobjdetect=OFF -DBUILD_opencv_stereo=OFF ..
|
||||
@@ -150,13 +220,31 @@ cmake --build . --config Release
|
||||
cmake --build . --config Release --target install
|
||||
cd $pwd
|
||||
#rm -rf opencv opencv_contrib
|
||||
fi
|
||||
|
||||
mkdir rtabmap
|
||||
# LAS
|
||||
if [ ! -e $prefix/include/liblas ]
|
||||
then
|
||||
if [ ! -e libLAS ]
|
||||
then
|
||||
git clone https://github.com/libLAS/libLAS.git
|
||||
fi
|
||||
cd libLAS
|
||||
sed -i '' 's/SHARED/STATIC/g' src/CMakeLists.txt
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_SYSROOT=$sysroot -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 -DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_FIND_ROOT_PATH=$prefix -DWITH_UTILITIES=OFF -DWITH_TESTS=OFF -DWITH_GEOTIFF=OFF ..
|
||||
cmake --build . --config Release -- CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED="NO" CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO"
|
||||
cmake --build . --config Release --target install -- CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED="NO" CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO"
|
||||
cd $pwd
|
||||
fi
|
||||
|
||||
mkdir -p rtabmap
|
||||
cd rtabmap
|
||||
cmake -DANDROID_PREBUILD=ON ../../../../..
|
||||
cmake --build . --config Release
|
||||
mkdir ios
|
||||
mkdir -p ios
|
||||
cd ios
|
||||
cmake -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_SYSROOT=$sysroot -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 -DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_FIND_ROOT_PATH=$prefix -DWITH_QT=OFF -DBUILD_APP=OFF -DBUILD_TOOLS=OFF -DWITH_TORO=OFF -DWITH_VERTIGO=OFF -DWITH_MADGWICK=OFF -DWITH_ORB_OCTREE=OFF -DBUILD_EXAMPLES=OFF ../../../../../..
|
||||
cmake -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_SYSROOT=$sysroot -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 -DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_FIND_ROOT_PATH=$prefix -DWITH_QT=OFF -DBUILD_APP=OFF -DBUILD_TOOLS=OFF -DWITH_TORO=OFF -DWITH_VERTIGO=OFF -DWITH_MADGWICK=OFF -DWITH_ORB_OCTREE=OFF -DBUILD_EXAMPLES=OFF -DWITH_LIBLAS=ON ../../../../../..
|
||||
cmake --build . --config Release
|
||||
cmake --build . --config Release --target install
|
||||
|
||||
Reference in New Issue
Block a user