APM Planner 2.0 Ubuntu MATE Build Failure..Need help!

Hello people,

I have been trying to build APM Planner 2.0 (latest version as of today) from github, but get some errors. The following are the steps I have taken:

  1. Installed Ubuntu MATE (v. 15.04) on Rpi-Model B+.
    Installed dependencies, as seen on github.com/apm_planner

  2. Some fixes to get it built (as seen on ArduPilot forum):

sudo mv /usr/lib/libGLESv2.so /usr/lib/libGLESv2.so.bak
sudo apt-get install qtdeclarative5-qtquick2-plugin
add framebuffer_depth=32 to /boot/config.txt

  1. Build APM Planner:

cd ~/workspace
git clone github.com/diydrones/apm_planner
cd ~/workspace/apm_planner
qmake qgroundcontrol.pro
make -j4

Any help is appreciated. Want to see it up and running!! :slight_smile:

ERRORS:
[color=#400080] Am I missing any dependencies? I tried to google, but the solution of adding <GLES/gl.h> to the header file did not help:

src/ui/CameraView.cc: In member function ‘virtual void CameraView::paintGL()’:
src/ui/CameraView.cc:240:94: error: ‘glDrawPixels’ was not declared in this scope
glDrawPixels(glImage.width(), glImage.height(), GL_RGBA, GL_UNSIGNED_BYTE, glImage.bits());
^
src/ui/CameraView.cc: In member function ‘virtual void CameraView::resizeGL(int, int)’:
src/ui/CameraView.cc:246:18: error: ‘GL_PROJECTION’ was not declared in this scope
glMatrixMode(GL_PROJECTION);
^
src/ui/CameraView.cc:246:31: error: ‘glMatrixMode’ was not declared in this scope
glMatrixMode(GL_PROJECTION);
^
src/ui/CameraView.cc:247:20: error: ‘glLoadIdentity’ was not declared in this scope
glLoadIdentity();
^
src/ui/CameraView.cc:248:30: error: ‘glOrtho’ was not declared in this scope
glOrtho(0, w, 0, h, -1, 1);
^
src/ui/CameraView.cc:249:18: error: ‘GL_MODELVIEW’ was not declared in this scope
glMatrixMode(GL_MODELVIEW);
^
Makefile:36685: recipe for target ‘build-release/obj/CameraView.o’ failed
make: *** [build-release/obj/CameraView.o] Error 1
make: *** Waiting for unfinished jobs…[/color]

Thanks,
Shyam

Don’t have the CAMERA_VIEW defined in the .pro file. It requires OpenGL, thenPi has OpenGLES

Thanks Bill, for your reply.

I saw that it required OpenGL. I had already installed it via ‘sudo apt-get install freeglut3-dev’. But seem that I might be missing a specific dependency?

You are better off removing CameraView. See this post,
viewtopic.php?f=82&t=12521

Thanks Carpy, the ‘make command’ seems to build. However, when running the application /apmplanner2, I get the following error:

Unable to find an X11 visual which matches EGL config 125
Could not initialize OpenGL

I know I am close, any help can get me to open the application successfully!!

Thanks!

Not sure about that one. Maybe you should remove freeglut3-dev?

I think you missunderstood me. OpenGL is not the same as OpenGLES, You cannot install OpenGL support on an RPi as the HW only supports OpenGLES.

Qt uses either OpenGL or OpenGLES to support QML. If you install OpenGL libraries the build probably gets confused.

Hi Bill, Carpy,

The solution to that error of OpenGL ‘at run-time’ was my resolved by simply rebooting my Pi-B+. The error did not show-up thereafter. Maybe, some sync issues. Thanks, what you said about OpenGLES makes sense to me now!

A step further:

  1. The application opens (but throws a stylesheet error on ‘Startup application’):

" QGroundControl did not load a new style Stylesheet file: files/styles/style-outdoor.css was not readable". I have this file in the respective directory, also looked for this error in the .cpp files of QGroundControl. The Outdoor Style does not happily load, what could be the cause of this?

  1. As APM Planner loads, I get the default map as ‘Google Hybrid’ and the right side of the map shows black (half map is black). Changing to Google maps works Ok. And how do I choose the default map? Any idea how this can be fixed?

<couldn’t attach screenshot, as this post does not allow>

My setup is same as you all, and followed everything to word, until now…

@Carpy and Bill, thanks so far!

Check to see if the file has similar permissions like the following:

-rw-rw-r-- 1 pi pi 10314 Sep 20 14:11 style-outdoor.css

The user and group in the above example are both pi.

Hi Carpy,

As you suggested I had checked, and the stylesheet settings are as follows:

drwxrwxr-x 12 gcs gcs 4096 Sep 17 01:28 …
-rw-rw-r-- 1 gcs gcs 14003 Sep 17 01:28 style-indoor.css
-rw-rw-r-- 1 gcs gcs 10314 Sep 17 01:28 style-outdoor.css
-rw-rw-r-- 1 gcs gcs 65932 Sep 17 01:28 Vera.ttf

Seems like the permissions are alright? And the other issue was blackout of half the map. I have got as far as opening the apm planner successfully and connecting via telemetry. Also, the map black-out disappears if I choose ‘Google Maps’ instead of the default ‘Google Hybrid’. Anyway, to make the ‘Google Maps’ as the default?

Thanks!

Permissions look good. I assume you are starting APM Planner 2 with user ‘gcs’?

So after changing the Map Type to Google Maps, the next time you start APM Planner 2 it doesn’t save the setting?

Hi, I also have encountered a similar issue. Tried installing APM Planner on my odroid XU4 with ubuntu mate. FATAL - Could not initialize OpenGL. However rebooting the odroid did not help. Any other suggestions?