Skip to content

Commit 28dbf1c

Browse files
authored
iOS feb 2025 various updates (#1451)
* Using shadows on all texts and icons to see them better when background is white. Buffering database previews to show faster the Library. Updated how RAM usage is computed and now show max memory. Added warnings when RAM usage is low. * Added measuring tool * fixed map not shown when closing visualization * Added measure text size setting, changed look and feel of point to point * Fixed measuring point not showing * Added fix for #1401 * Addressing #1407 * Export: Added colored OBJ options * fixed index_t not existing on focal * Fixed Settings not applied after restoring to all default settings witohut restarting the app (Marker detection not working issue #1455 ) * Marker detection: Fixing wrong depth used when rgb and depth image sizes cannot be divided exactly one from the the other #1455 * Added Marker Max Range option (default 1m) * Added OBJ texture policy option (keep color on textureless polygons) * Added texture/color blending option directly in the app. Added LAZ export option. * Hiding measuring button if not mesh, dont zip if exporting to laz, updating Export XXX button based on the current context, fixed always blending texture/color on not visualization mode * updated default marker max range to 2m * bump ios app version * fixing pcl 1.8.1 build * fixed android build
1 parent f329ebd commit 28dbf1c

40 files changed

+3405
-458
lines changed

app/android/jni/CMakeLists.txt

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ SET(INCLUDE_DIRS
33
${CMAKE_CURRENT_SOURCE_DIR}
44
${CMAKE_CURRENT_SOURCE_DIR}/tango-gl/include
55
${CMAKE_CURRENT_SOURCE_DIR}/third-party/include
6-
${PROJECT_BINARY_DIR}/corelib/include
7-
${PROJECT_SOURCE_DIR}/corelib/include
8-
${PROJECT_SOURCE_DIR}/utilite/include
6+
${PROJECT_BINARY_DIR}/corelib/include
7+
${PROJECT_SOURCE_DIR}/corelib/include
8+
${PROJECT_SOURCE_DIR}/utilite/include
9+
${CMAKE_CURRENT_BINARY_DIR}
910
${OpenCV_INCLUDE_DIRS}
1011
${PCL_INCLUDE_DIRS}
1112
"${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}/usr/include"
@@ -24,14 +25,19 @@ set(sources
2425
point_cloud_drawable.cpp
2526
graph_drawable.cpp
2627
background_renderer.cc
28+
text_drawable.cpp
29+
quad_color.cpp
30+
tango-gl/bounding_box.cpp
2731
tango-gl/axis.cpp
2832
tango-gl/camera.cpp
33+
tango-gl/circle.cpp
2934
tango-gl/conversions.cpp
3035
tango-gl/drawable_object.cpp
3136
tango-gl/frustum.cpp
3237
tango-gl/gesture_camera.cpp
3338
tango-gl/grid.cpp
3439
tango-gl/line.cpp
40+
tango-gl/mesh.cpp
3541
tango-gl/shaders.cpp
3642
tango-gl/trace.cpp
3743
tango-gl/transform.cpp
@@ -114,7 +120,35 @@ add_definitions(${PCL_DEFINITIONS})
114120

115121
INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
116122

117-
add_library(NativeRTABMap SHARED ${sources})
123+
####################################
124+
# Generate resources files
125+
####################################
126+
SET(RESOURCES
127+
${CMAKE_CURRENT_SOURCE_DIR}/resources/text_atlas.png
128+
)
129+
130+
foreach(arg ${RESOURCES})
131+
get_filename_component(filename ${arg} NAME)
132+
string(REPLACE "." "_" output ${filename})
133+
set(RESOURCES_HEADERS "${RESOURCES_HEADERS}" "${CMAKE_CURRENT_BINARY_DIR}/${output}.h")
134+
endforeach(arg ${RESOURCES})
135+
136+
find_host_program(RTABMAP_RES_TOOL rtabmap-res_tool PATHS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
137+
IF(NOT RTABMAP_RES_TOOL)
138+
MESSAGE( FATAL_ERROR "RTABMAP_RES_TOOL is not defined (it is the path to \"rtabmap-res_tool\" application created by a non-Android build)." )
139+
ENDIF(NOT RTABMAP_RES_TOOL)
140+
141+
ADD_CUSTOM_COMMAND(
142+
OUTPUT ${RESOURCES_HEADERS}
143+
COMMAND ${RTABMAP_RES_TOOL} -n rtabmap -p ${CMAKE_CURRENT_BINARY_DIR} ${RESOURCES}
144+
COMMENT "[Creating resources]"
145+
DEPENDS ${RESOURCES}
146+
)
147+
####################################
148+
# Generate resources files END
149+
####################################
150+
151+
add_library(NativeRTABMap SHARED ${sources} ${RESOURCES_HEADERS})
118152
target_link_libraries(NativeRTABMap ${LIBRARIES}
119153
android
120154
log

app/android/jni/CameraMobile.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ void CameraMobile::close()
108108
dataReady_.release();
109109
}
110110

111-
void CameraMobile::resetOrigin()
111+
void CameraMobile::resetOrigin(const rtabmap::Transform & offset)
112112
{
113+
manualOriginOffset_ = offset;
113114
originUpdate_ = true;
114115
}
115116

@@ -193,7 +194,7 @@ void CameraMobile::poseReceived(const Transform & pose, double deviceStamp)
193194
previousAnchorPose_.setNull();
194195
previousAnchorLinearVelocity_.clear();
195196
previousAnchorStamp_ = 0.0;
196-
originOffset_ = pose.translation().inverse();
197+
originOffset_ = manualOriginOffset_.isNull() ? pose.translation().inverse() : manualOriginOffset_;
197198
originUpdate_ = false;
198199
}
199200

app/android/jni/CameraMobile.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class CameraMobile : public Camera, public UEventsSender {
9999
void update(const SensorData & data, const Transform & pose, const glm::mat4 & viewMatrix, const glm::mat4 & projectionMatrix, const float * texCoord);
100100
void updateOnRender();
101101

102-
void resetOrigin();
102+
void resetOrigin(const rtabmap::Transform & offset = rtabmap::Transform());
103103
virtual bool isCalibrated() const;
104104

105105
virtual bool odomProvided() const { return true; }
@@ -150,6 +150,7 @@ class CameraMobile : public Camera, public UEventsSender {
150150
EnvSensors lastEnvSensors_;
151151
Transform originOffset_;
152152
bool originUpdate_;
153+
rtabmap::Transform manualOriginOffset_;
153154
float upstreamRelocalizationAccThr_;
154155
rtabmap::Transform previousAnchorPose_;
155156
std::vector<float> previousAnchorLinearVelocity_;

app/android/jni/Measure.h

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
Copyright (c) 2010-2025, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above copyright
10+
notice, this list of conditions and the following disclaimer in the
11+
documentation and/or other materials provided with the distribution.
12+
* Neither the name of the Universite de Sherbrooke nor the
13+
names of its contributors may be used to endorse or promote products
14+
derived from this software without specific prior written permission.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
*/
27+
28+
#ifndef MEASURE_H_
29+
#define MEASURE_H_
30+
31+
#include <opencv2/opencv.hpp>
32+
33+
class Measure
34+
{
35+
public:
36+
Measure(
37+
const cv::Point3f & pt1,
38+
const cv::Point3f & pt2,
39+
const cv::Vec3f & n1,
40+
const cv::Vec3f & n2) :
41+
pt1_(pt1),
42+
pt2_(pt2),
43+
n1_(n1),
44+
n2_(n2)
45+
{
46+
length_ = cv::norm(pt2_ - pt1_);
47+
}
48+
virtual ~Measure() {}
49+
50+
float length() const {return length_;}
51+
const cv::Point3f & pt1() const {return pt1_;}
52+
const cv::Point3f & pt2() const {return pt2_;}
53+
const cv::Vec3f & n1() const {return n1_;}
54+
const cv::Vec3f & n2() const {return n2_;}
55+
56+
private:
57+
cv::Point3f pt1_;
58+
cv::Point3f pt2_;
59+
cv::Vec3f n1_;
60+
cv::Vec3f n2_;
61+
float length_;
62+
};
63+
64+
65+
#endif /* MEASURE_H_ */

0 commit comments

Comments
 (0)