Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split out mavconn libaray to use in non ros projects. #161

Closed
vooon opened this issue Nov 2, 2014 · 13 comments
Closed

Split out mavconn libaray to use in non ros projects. #161

vooon opened this issue Nov 2, 2014 · 13 comments
Milestone

Comments

@vooon
Copy link
Member

vooon commented Nov 2, 2014

MAVConn library may be useful in standalone projects where needed mavlink.

vooon added a commit that referenced this issue Nov 2, 2014
Also rosconsole replaced by console_bridge, so now library can be used
without ros infrastructure.
vooon added a commit that referenced this issue Nov 2, 2014
vooon added a commit that referenced this issue Nov 2, 2014
vooon added a commit that referenced this issue Nov 2, 2014
* master:
  mavconn #161: Move mavconn tests.
  mavconn #161: Fix headers used in mavros. Add readme.
  mavconn #161: Fix mavros build.
  mavconn #161: Move library to its own package
  plugin: sys_time: Set right suffixes to uint64_t constants.
  plugin: sys_time: Add time syncronization diag.
  plugin: sys_time: Debug result.
vooon added a commit that referenced this issue Nov 2, 2014
vooon added a commit that referenced this issue Nov 2, 2014
vooon added a commit that referenced this issue Nov 2, 2014
* master:
  mavconn #161: Enable rosconsole bridge.
  mavconn #161: try to fix hydro build
@vooon
Copy link
Member Author

vooon commented Nov 2, 2014

Complete.

@vooon vooon closed this as completed Nov 2, 2014
@vooon vooon added this to the Release 0.9.0 milestone Nov 2, 2014
nmichael pushed a commit to rislab/mavros that referenced this issue Mar 19, 2016
add .project and .pydevproject to .gitignore
@rxdu
Copy link

rxdu commented Nov 7, 2016

Hi,

I know this is a closed issue but I'm having trouble in compiling libmavconn separately. I just treat the libmavconn folder as a standalone cmake project package and tried to cmake and make. I got no error during the cmake process. But during "make", the compiler complains that:

<full-path-on-my-computer>/libmavconn/include/mavconn/mavlink_dialect.h:23:42: fatal error: mavlink/v2.0/common/common.hpp: No such file or directory
 #include <mavlink/v2.0/common/common.hpp>

It seems the mavlink header auto generation was not triggered properly. I was wondering how I could fix this error and get this package compiled so that I can use it in a non-ROS project. @vooon

Thanks,
rxdu

@vooon
Copy link
Member Author

vooon commented Nov 7, 2016

@rxdu you also need mavlink headers library in your include path. Generating it is not libmavconn task.
c_library_v2 unfortunately not have C++11 lib, so you should generate headers yourself.

Perhaps you may use https://github.com/mavlink/mavlink-gbp-release (branch release/kinetic/mavlink), because it is almost pure cmake file (look master patch dir).

Also recent version of libmavconn use my C++11 generator, which can be found at ArduPilot/pymavlink#27

@rxdu
Copy link

rxdu commented Nov 12, 2016

Thanks for your reply @vooon. Now I can compile libmavconn as a standalone package.

Here is a summary of how I got all missing headers (for anyone else who may find helpful in the future):

  1. Copy out libmavconn out from the mavros repository.
  2. Try to build the project:
$ cd libmavconn
$ mkdir build
$ cd build
$ make

You will get the error telling you some header files are missing for mavlink.
3. Then use the C++11 generator from vooon to build the .hpp files from .xml files (you need to get those mavlink msg definitions from the mavlink repository). Copy the entire v2.0 folder generated by mavgen.py to libmavconn/include/mavlink/v2.0.
Try to compile again, you will get errors saying some .h files for mavlink are still missing.
4. Now use branch release/kinetic/mavlink from repo "mavlink-gdb-release" to build the missing .h files. Still regular cmake & make steps. Now you can copy the generated .h files under mavlink-gdb-release/build/include/v2.0 into the C++11 header folder. (I tried to got those .h files with same names from repo c_library_v2, but they seem not fully match the ones required here.)
5. Try to build libmavconn again. Now you should get no error.

I'm not sure if it is the best way to do this. But it at least compiles now. I will do further tests and see if everything works as expected.

@vooon
Copy link
Member Author

vooon commented Nov 12, 2016

3-4 may be done much easier:

git clone https://github.com/mavlink/mavlink-gbp-release -b release/kinetic/mavlink
mkdir mavlink-gbp-release/build
cd mavlink-gbp-release/build
cmake ..
make

tree include/v2.0

Mixing c_library_v2 with gbp is bad. All what you need already done by gpb.
Except you may need fresh message definitions xml (gpb has monthly release).

@clichtz
Copy link

clichtz commented Apr 12, 2021

Not 100% on topic, but definitely related. Is there a way of removing the dependency of libmavconn on the default dialects if I don't want to use them?

@vooon
Copy link
Member Author

vooon commented Apr 12, 2021

@clichtz libmavconn depends on all dialects, they all must be compilled beforehand.
You could provide alternative dialect set, just add your definition to message_definitions/v1.0.

@clichtz
Copy link

clichtz commented Apr 13, 2021

My thing is that I don't want to use them and since I am not using libmavconn with ros I have to have all of the dialects in my repo, which is a lot of files. But as far as I could figure, some generated files depend on the dialects, and just wanted to know if there was an alternative.

@vooon
Copy link
Member Author

vooon commented Apr 13, 2021

There are no direct dependency on dialect, except generated include and helpers files, empy context and unit tests.
You can ignore test and fix context script.

@rishabsingh3003
Copy link

Hi @vooon,
I am trying to use mavconn outside ROS, and I have been successful in building it using your comments above.
However when I try to include the library in my cmake file (find_package(libmavconn REQUIRED)) , I get the following error:
image

I must be doing something wrong but I can't figure it out.. do you have any clues?

@clichtz
Copy link

clichtz commented May 8, 2021

Did you try doing find_package(mavconn) instead?

@vooon
Copy link
Member Author

vooon commented May 11, 2021

@rishabsingh3003 could you please post here content of libmavconnConfig.cmake?

Also perhaps libmavconn from ros2 branch is having more portable build script:
https://github.com/mavlink/mavros/tree/ros2/libmavconn

@mcelhennyi
Copy link

Anyone that comes here looking for this, we made an easy to use repo for generating this here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants