ArduPilot / companion

Companion computer startup scripts and examples
GNU General Public License v3.0
104 stars 164 forks source link

ArduPilot web server (work in progress) #30

Closed tridge closed 7 years ago

tridge commented 7 years ago

This is a port to Linux of a web service for ArduPilot that I developed for another project. It provides a MAVLink<->JSON gateway, along with a html5/javascript web interface

fnoop commented 7 years ago

I get this error trying to make:

Generating version.h
make[1]: Leaving directory '/srv/maverick/var/build/companion/web_server/files'
mavgen.py --lang C ../mavlink/message_definitions/v1.0/ardupilotmega.xml -o generated/mavlink --wire-protocol=2.0
Validating ../mavlink/message_definitions/v1.0/ardupilotmega.xml
Traceback (most recent call last):
  File "/usr/local/bin/mavgen.py", line 30, in <module>
    mavgen.mavgen(args, args.definitions)
  File "/usr/local/lib/python2.7/dist-packages/pymavlink/generator/mavgen.py", line 76, in mavgen
    if not mavgen_validate(fname):
  File "/usr/local/lib/python2.7/dist-packages/pymavlink/generator/mavgen.py", line 55, in mavgen_validate
    xmlschema.assertValid(xmldocument)
  File "src/lxml/lxml.etree.pyx", line 3491, in lxml.etree._Validator.assertValid (src/lxml/lxml.etree.c:194796)
lxml.etree.DocumentInvalid: Element 'field', attribute 'units': The attribute 'units' is not allowed., line 884
Makefile:15: recipe for target 'generated/mavlink/ardupilotmega/mavlink.h' failed
make: *** [generated/mavlink/ardupilotmega/mavlink.h] Error 1
peterbarker commented 7 years ago

On Wed, 7 Jun 2017, Fnoop wrote:

I get this error trying to make:

Update your pymavlink (from github...... fresh code!)

fnoop commented 7 years ago

Updated to latest, installed libtalloc-dev, now get:

gcc -Wall -g -Werror   -c -o mavlink_json.o mavlink_json.c
mavlink_json.c: In function ‘mavlink_message_send_args’:
mavlink_json.c:129:39: error: implicit declaration of function ‘mavlink_get_message_info_by_name’ [-Werror=implicit-function-declaration]
     const mavlink_message_info_t *m = mavlink_get_message_info_by_name(msg_name);
                                       ^
mavlink_json.c:129:39: error: initialization makes pointer from integer without a cast [-Werror=int-conversion]
cc1: all warnings being treated as errors
<builtin>: recipe for target 'mavlink_json.o' failed
make: *** [mavlink_json.o] Error 1
peterbarker commented 7 years ago

On Wed, 7 Jun 2017, Fnoop wrote:

mavlink_json.c:129:39: error: implicit declaration of function ‘mavlinkget

That's the problem. Someone's not including something :-)

Might be as simple as '#include "mavlink_get_info.h"'

I'll look at it tomorrow (but will check for a PR first :-P

Peter

davidbuzz commented 7 years ago

To maintain the pre-existing Repo organisation structure ( see readme ) , I think this work should actually be in Common/web_server/ and Common/mavlink/

peterbarker commented 7 years ago

On Wed, 7 Jun 2017, Buzz wrote:

To maintain the pre-existing Repo organisation structure ( see readme ) , I think this work should actually be in Common/web_server/ and Common/mavlink/

We don't really have precedent for carrying an entire project in companion :-)

But yes, Common makes sense.

I'm making some modifications to this so that:

We might also add a single udp-out port at some stage so this web server can do the serial port and forward to cmavnode/mavproxy/mavlink-router).

tridge commented 7 years ago
 const mavlink_message_info_t *m = mavlink_get_message_info_by_name(msg_name);

it needs an updated pymavlink install. Either use pymavlink master or use the submodule in the PR

tridge commented 7 years ago

i've released pymavlink 2.2.3 into pip that fixes it

davidbuzz commented 7 years ago

ok, I needed to update pymavlink to 2.2.3 sudo pip install --upgrade pymavlink make clean make

I also had to hack the reboot() from void-reboot(void) to int reboot(int) to get it to compile on osx. :-)

davidbuzz commented 7 years ago

here's a .patch for osx compatability: https://gist.github.com/davidbuzz/2741be7a5e5c61fe2b0745a4065cc07d

tridge commented 7 years ago

after some discussion with Randy and Peter, I've moved this to a new repo: https://github.com/ArduPilot/APWeb so closing this PR