Build project with example code but failed, Any help great appreciated!

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Build project with example code but failed, Any help great appreciated!

derwee
Hi Matlabbe,
I am new blood with C++ and Cmake, I intend to compile a example project with source code(rtabmap-master/examples/BOWMapping) to get well understand to Rtabmap.  But It encounter some errors. Actually I have install Rtabmap by source code, But I compile example project standalone failed. May I recompile a standalone project with example code? Anyone can share the CMakeLists.txt  with me ? any help great appreciated!

Error log:
root@derwee-ThinkPad-T440:/derwee/rtabmap-master/examples/BOWMapping# make
Scanning dependencies of target bow_mapping
[100%] Building CXX object CMakeFiles/bow_mapping.dir/main.o
/derwee/rtabmap-master/examples/BOWMapping/main.cpp:28:34: fatal error: rtabmap/core/Rtabmap.h: No such file or directory
 #include "rtabmap/core/Rtabmap.h"
                                  ^
compilation terminated.
make[2]: *** [CMakeFiles/bow_mapping.dir/main.o] Error 1
make[1]: *** [CMakeFiles/bow_mapping.dir/all] Error 2
make: *** [all] Error 2
Reply | Threaded
Open this post in threaded view
|

Re: Build project with example code but failed, Any help great appreciated!

matlabbe
Administrator
Look at the CMake on this page: https://github.com/introlab/rtabmap/wiki/Cplusplus-Loop-Closure-Detection
cmake_minimum_required(VERSION 2.8)
PROJECT( MyProject )

FIND_PACKAGE(RTABMap REQUIRED)
FIND_PACKAGE(OpenCV REQUIRED)

SET(INCLUDE_DIRS
    ${RTABMap_INCLUDE_DIRS}
    ${OpenCV_INCLUDE_DIRS}
)

SET(LIBRARIES
    ${RTABMap_LIBRARIES}
    ${OpenCV_LIBRARIES} 
)

INCLUDE_DIRECTORIES(${INCLUDE_DIRS})

ADD_EXECUTABLE(example main.cpp)
TARGET_LINK_LIBRARIES(example ${LIBRARIES})

For RGB-D mapping, you may want to check on this page example instead: https://github.com/introlab/rtabmap/wiki/Cplusplus-RGBD-Mapping

cheers
Reply | Threaded
Open this post in threaded view
|

Re: Build project with example code but failed, Any help great appreciated!

derwee
Hi Matlabbe,
Thanks for your help.
I have compiled a total project.
I intend to extract path info to extend localization function when building map as below.
1.speak out position
2.added identifer label to easy localization

In order to added some label to some node when localised some point, Could you show me which class should I pay more attention?  is There some implements function in source code packaged in some libs(so)? Such as std::multimap<Int,pcl::PointXYZ> localMap_.insert()

blue node in path:

Reply | Threaded
Open this post in threaded view
|

Re: Build project with example code but failed, Any help great appreciated!

matlabbe
Administrator
Hello derwee,

I don't know if I understand correctly your problem. In ROS, you can call "set_label" service to set a label to a node:
$ rosservice call /rtabmap/set_label 0 "my_label"
(0 means latest node)

For the standalone, I've recently added the possibility to add labels from the GUI. See Detection menu -> "Label current location...". Labels are then shown in the 3D map view.

If you want to do your own functionality using voice commands to add a label, you can see the MainWindow::label() method. It posts a RtabmapEventCmd event to send the label to rtabmap thread.

If you are using the rtabmap object directly, you can call Rtabmap::labelLocation() method.

cheers
Reply | Threaded
Open this post in threaded view
|

Re: Build project with example code but failed, Any help great appreciated!

derwee
Hi Matlabbe,

That's I looking forward, This saved us a lot of time. many thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Build project with example code but failed, Any help great appreciated!

derwee
In reply to this post by matlabbe
Hi Matlabbe,
We try to get label in map with sensor data which from kinect. But failed. How to current signatur which match with sensor data?  When we call interface rtabmap.getMemory()->getLastWorkingSignature()->id(), It return the last one in map. Is there some way to implement this requirement? Thanks.
                                   
                                       //retrieve all the signature to get label
                                        std::set<int> sigs = rtabmap.getMemory()->getAllSignatureIds();
                                        std::set<int>::iterator iter = sigs.begin();
                                        while (iter != sigs.end()) {
                                                printf("reeman signaturId= %d \n", *iter);
                                                const rtabmap::Signature *signature = rtabmap.getMemory()->getSignature(*iter);
                                                if (signature != NULL) {
                                                        label3 = rtabmap.getMemory()->getSignature(*iter)->getLabel();
                                                        printf("reeman I'm in label3= %s \n", label3.c_str());
                                                }
                                                iter++;
                                        }
Reply | Threaded
Open this post in threaded view
|

Re: Build project with example code but failed, Any help great appreciated!

matlabbe
Administrator
Each signature contains a SensorData: Signature::sensorData(). If you want to get sensor data from all signatures (including those in long-term memory) having a label, you may want to do something like this:

std::map<int, Signature> signatures;
std::map<int, Transform> poses;
std::multimap<int, Link> constraints;
rtabmap.get3DMap(signatures, poses, constraints, true, true);

"signatures" contains all signatures from memory, including those not linked to the global map.
"poses" contains the poses of signatures in the global map.

You can iterate over "signatures" to get the labels and sensor data. Note that "signatures" is a copy of the memory. To modify a label, you should use
rtabmap.labelLocation(id, label);

cheers