Giter Club home page Giter Club logo

multiwii_python's People

Contributors

andreiciubotariu avatar bchchak avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

1017flocka

multiwii_python's Issues

exceptions

I added a couple of prints so i could try and figure out what it's doing. and i'm getting exceptions. I'm new to the MSP protocol and i'm working with 2.1 of inav which apparently uses the v2 version of MSP.

I'm trying to get GPS data from the FC that's all i'm really interested in. So right now the main looks like the following:

i'm assuming the "container" section is the reply from the FC to the IDENT? When I tried the program unmodified, i got the exception in the second code section (under the dashes).

Any help would be appreciated in getting at the GPS data

if __name__ == '__main__':
    transport = Serial(port='/dev/ttyACM0',
                       baudrate=115200,
                       timeout=5)
    msp = MSP(transport, initialization_delay=15)

    stop_gps_updates(msp)

    print("Getting IDENT")
    print(msp.request(MSP_IDENT))


    counter = 0
    print("Getting RAW_GPS")
    while True:
         print(counter)
         print(msp.receive_data(msp.get_response(MSP_RAW_GPS)))
         print(msp.request(MSP_ALTITUDE))
         counter += 1
         time.sleep(1)
Waiting 15 seconds for board to wake up
Done waiting
Sending MSP len 10
Getting IDENT
Sending MSP len 6
Container:
    preamble = b'$M' (total 2)
    direction = b'>' (total 1)
    size = 7
    message_id = 100
    version = 231
    multitype = 3
    msp_version = 0
    capability = 2147483708
    crc = 59
Getting RAW_GPS
0
Attempted to parse b''
Traceback (most recent call last):
  File "msp.py", line 327, in <module>
    print(msp.receive_data(msp.get_response(MSP_RAW_GPS)))
  File "msp.py", line 293, in receive_data
    return self.parse(received_data, parser)
  File "msp.py", line 275, in parse
    parsed_data = template.parse(data)
  File "/home/charlesb/.local/lib/python3.6/site-packages/construct/core.py", line 304, in parse
    return self.parse_stream(io.BytesIO(data), **contextkw)
  File "/home/charlesb/.local/lib/python3.6/site-packages/construct/core.py", line 316, in parse_stream
    return self._parsereport(stream, context, "(parsing)")
  File "/home/charlesb/.local/lib/python3.6/site-packages/construct/core.py", line 328, in _parsereport
    obj = self._parse(stream, context, path)
  File "/home/charlesb/.local/lib/python3.6/site-packages/construct/core.py", line 1979, in _parse
    subobj = sc._parsereport(stream, context, path)
  File "/home/charlesb/.local/lib/python3.6/site-packages/construct/core.py", line 328, in _parsereport
    obj = self._parse(stream, context, path)
  File "/home/charlesb/.local/lib/python3.6/site-packages/construct/core.py", line 2468, in _parse
    return self.subcon._parsereport(stream, context, path)
  File "/home/charlesb/.local/lib/python3.6/site-packages/construct/core.py", line 328, in _parsereport
    obj = self._parse(stream, context, path)
  File "/home/charlesb/.local/lib/python3.6/site-packages/construct/core.py", line 2538, in _parse
    obj = self.subcon._parsereport(stream, context, path)
  File "/home/charlesb/.local/lib/python3.6/site-packages/construct/core.py", line 328, in _parsereport
    obj = self._parse(stream, context, path)
  File "/home/charlesb/.local/lib/python3.6/site-packages/construct/core.py", line 856, in _parse
    return stream_read(stream, length)
  File "/home/charlesb/.local/lib/python3.6/site-packages/construct/core.py", line 86, in stream_read
    raise StreamError("stream read less then specified amount, expected %d, found %d" % (length, len(data)))
construct.core.StreamError: stream read less then specified amount, expected 2, found 0

charlesb@GroundStation:~/src/msp/multiwii_python$ python3 msp.py
Waiting 15 seconds for board to wake up
Done waiting
Sending MSP len 10
Sending MSP len 6
Container:
    preamble = b'$M' (total 2)
    direction = b'>' (total 1)
    size = 7
    message_id = 100
    version = 231
    multitype = 3
    msp_version = 0
    capability = 2147483708
    crc = 59
0
Drop flotation device (timed)
Sending MSP len 7
Attempted to parse b'$M>H4\x00'
Traceback (most recent call last):
  File "msp.py", line 364, in <module>
    msp.read_ack(MSP_SET_RC_OVERRIDES)
  File "msp.py", line 251, in read_ack
    ack = self.receive_data(MSP_ACK)
  File "msp.py", line 293, in receive_data
    return self.parse(received_data, parser)
  File "msp.py", line 275, in parse
    parsed_data = template.parse(data)
  File "/home/charlesb/.local/lib/python3.6/site-packages/construct/core.py", line 304, in parse
    return self.parse_stream(io.BytesIO(data), **contextkw)
  File "/home/charlesb/.local/lib/python3.6/site-packages/construct/core.py", line 316, in parse_stream
    return self._parsereport(stream, context, "(parsing)")
  File "/home/charlesb/.local/lib/python3.6/site-packages/construct/core.py", line 328, in _parsereport
    obj = self._parse(stream, context, path)
  File "/home/charlesb/.local/lib/python3.6/site-packages/construct/core.py", line 1979, in _parse
    subobj = sc._parsereport(stream, context, path)
  File "/home/charlesb/.local/lib/python3.6/site-packages/construct/core.py", line 328, in _parsereport
    obj = self._parse(stream, context, path)
  File "/home/charlesb/.local/lib/python3.6/site-packages/construct/core.py", line 2468, in _parse
    return self.subcon._parsereport(stream, context, path)
  File "/home/charlesb/.local/lib/python3.6/site-packages/construct/core.py", line 328, in _parsereport
    obj = self._parse(stream, context, path)
  File "/home/charlesb/.local/lib/python3.6/site-packages/construct/core.py", line 2540, in _parse
    raise ConstError("parsing expected %r but parsed %r" % (self.value, obj))
construct.core.ConstError: parsing expected 0 but parsed 72

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.