rpg_svo | Semi-direct Visual Odometry | Robotics library
kandi X-RAY | rpg_svo Summary
kandi X-RAY | rpg_svo Summary
This code implements a semi-direct monocular visual odometry pipeline. SVO has been tested under ROS Groovy, Hydro and Indigo with Ubuntu 12.04, 13.04 and 14.04. This is research code, any fitness for a particular purpose is disclaimed. The source code is released under a GPLv3 licence. A closed-source professional edition is available for commercial purposes. In this case, please contact the authors for further info.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of rpg_svo
rpg_svo Key Features
rpg_svo Examples and Code Snippets
Community Discussions
Trending Discussions on rpg_svo
QUESTION
While I was reading an open-source code, I found the following where a shared pointer is passed to a function in two different ways.
class A{A();};
typedef std::shared_ptr A_Ptr;
void func1(A_Ptr a);
void func2( const A_Ptr& a);
What is the reason to pass it as a reference when const is used? I understand the writer of the func2 does not expect the function to be able to change anything in a. But can't we just do this const A_Ptr a
? Also, what are the reason we shouldn't pass it with A_Ptr & a
in func1?
Occurance of the above in the code:
Git: https://github.com/uzh-rpg/rpg_svo/
void FrameHandlerMono::setFirstFrame(const FramePtr& first_frame)
...ANSWER
Answered 2019-Aug-07 at 02:55But can't we just do this
const FramePtr
frame?
Sure, we could, but then the copy constructor would be invoked, which is for larger types (anything larger than the built-in types) normally more expensive than passing by reference. This is nothing specific to shared_ptr
. It should be generally your default to pass any objects by const reference if you don't need a copy and don't want to change them. Only built-in types like int, float, or char should be passed-by-value.
More interesting is why func1
uses a copy. Most probable case is that he needs a copy anyway, because he wants to keep a reference in the class. I couldn't find the exact file you're refering to in the github repository you've posted. If it's still unclear please past the function body of func1 into the question.
Edit: Ah, I see. Looks like the reason he passes-by-value here, has more to do with thread-safety. Didn't read the whole but otherwise the shared_ptr
might be deleted by the owning thread if he passed by const reference.
Here for examle func needs pass-by-value cause otherwise the pointer could be deleted by the main thread. Probably something like this but more complicated:
QUESTION
I am attempting to port some code from Linux to windows, and am having trouble.
This line:
...ANSWER
Answered 2017-Jan-28 at 18:55It's a gcc to MSVC issue. According to the documentation., the equivalent MSVC feature would be __declspec(align(16))
.
If your compiler supports C++11, you can also use the alignas
declaration.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install rpg_svo
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page