questions on interfacing with a multiwii board with python

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
faceless105
Posts: 2
Joined: Sat Dec 24, 2016 6:14 pm

questions on interfacing with a multiwii board with python

Post by faceless105 »

First, I want to give a big thanks for working on something so awesome. I dabbled with a decent sized quad and I was kind of blown away at how many sensors are packed into those boards. On top of that, to keep it all open and standardized is nothing short of amazing.

Now for why I'm posting. I'm working on a robotics project and I'm hoping to use a Quadrino Zoom V3 Flight Controller to collect a decent chunk of positional info while it's running. I'm connecting the board to a raspberry pi which hasn't been an issue. I've also had no problem running the multiwii config utility to see that everything is working as it should. Where I'm getting hung up currently is being able to fetch the info directly.

I'm building off of this repo (if you have another python example, I'd be happy to take a look at it).

I then added code for the GPS data in a similar fashion to how the attitude data is being retrieved.

I have added this to the init function:

Code: Select all

self.rawgps = {'fix':0,'numSat':0,'lat':0,'lon':0,'alt':0,'speed':0,'elapsed':0,'timestamp':0}


to the getData function:

Code: Select all

elif cmd == MultiWii.RAW_GPS:
    self.rawgps['fix']=float(temp[0])
    self.rawgps['numSat']=float(temp[1])
    self.rawgps['lat']=float(temp[2])
    self.rawgps['lon']=float(temp[3])
    self.rawgps['alt']=float(temp[4])
    self.rawgps['speed']=float(temp[5])
    self.rawgps['elapsed']=round(elapsed,3)
    self.rawgps['timestamp']="%0.2f" % (time.time(),)
    return self.rawgps


and to the getDataInf function

Code: Select all

elif cmd == MultiWii.RAW_GPS:
    self.rawgps['fix']=float(temp[0])
    self.rawgps['numSat']=float(temp[1])
    self.rawgps['lat']=float(temp[2])
    self.rawgps['lon']=float(temp[3])
    self.rawgps['alt']=float(temp[4])
    self.rawgps['speed']=float(temp[5])
    self.rawgps['elapsed']="%0.3f" % (elapsed,)
    self.rawgps['timestamp']="%0.2f" % (time.time(),)


I'm basing this on the output I'm reading at: http://www.multiwii.com/wiki/index.php? ... l_Protocol

Then I call the code with

Code: Select all

board.getData(MultiWii.RAW_GPS)
print board.rawgps


The problem is, I'm having a hard time making sense of the output.

Code: Select all

{'alt': -12738.0, 'timestamp': '1494887366.41', 'lat': 6434.0, 'speed': 208.0, 'fix': 2561.0, 'lon': 24919.0, 'numSat': -21303.0, 'elapsed': 0.009}
{'alt': -12738.0, 'timestamp': '1494887366.41', 'lat': 6434.0, 'speed': 208.0, 'fix': 2561.0, 'lon': 24919.0, 'numSat': -21303.0, 'elapsed': 0.009}
{'alt': -12738.0, 'timestamp': '1494887366.41', 'lat': 6434.0, 'speed': 208.0, 'fix': 2561.0, 'lon': 24919.0, 'numSat': -21303.0, 'elapsed': 0.009}
{'alt': -12738.0, 'timestamp': '1494887366.41', 'lat': 6434.0, 'speed': 208.0, 'fix': 2561.0, 'lon': 24919.0, 'numSat': -21303.0, 'elapsed': 0.009}
{'alt': -12738.0, 'timestamp': '1494887366.41', 'lat': 6434.0, 'speed': 208.0, 'fix': 2561.0, 'lon': 24919.0, 'numSat': -21303.0, 'elapsed': 0.009}


I don't know why I'm at a negetive altitude, the lat/lon aren't what I expected either. Even the numSat, and the fix fields. I'd anticipate nothing higher than 15 for numSat (if I'm assuming that it's the number of connected satellites), and fix says in the documentation that it should be 1 or 0, I assume for if it has a fix on enough satellites. I'm really hoping that someone might be able to help me make some sense of this or point me in the right direction. It's really awesome to potentially have so much data available, I'm really hoping to be able to put it all to good use.

Post Reply