# Given the speed of an object expressed in NED, how can i plot its position relative to a fixed starting point?

Firstly, sorry in advanced for my convoluted description, I think it's always a sign of not understanding the subject when one find its hard to even explain the question in the right terms, hopefully someone can understand my issue.

I am tasked with creating some kind of user interface to fly a drone (semi)autonomously. As this will happen indoors, I do not have access to any GPS information, but simply frequent sensor updates as to what speed the drone is flying, expressed in North-East-Down.

speedX (float): Speed relative to the North (when drone moves to the north, speed is > 0) (in m/s)

speedY (float): Speed relative to the East (when drone moves to the east, speed is > 0) (in m/s)

speedZ (float): Speed on the z axis (when drone moves down, speed is > 0) (in m/s)

In calculating realtime values for these, I sample the sensor data at regular intervals, combining the previous values and the time between them in order to calculate the distance. (eg: distance = previousDistance + (previousSpeedX * secondsSincePreviousSensorReading). However in actually calculating the x,y position relative to my local space - what else do I need?

I originally thought I could simply plot the position based on the angle to north at take off (0,0) but it seems to me that I would actually need to know what direction north is for every subsequent sensor reading as once the drone has moved, subsequent sensor readings of x would be relative to the drone's current relation to north and not its original take off position.

In addition to NED acceleration, I also have access to the yaw,pitch,roll attitudes of the drone (in radians). I considered using the yaw but this also seems to me as if it would not be enough as it relates to the position the front of the drone is facing, whereas what I would need is the angle between the drones centre of gravity and north?

Assuming what I have thought so far is correct (not likely - I never paid much attention to trigonometry in school saldy), is there a way for me to calculate "north" at each intermediary movement of the object?

Many thanks in advance!

EDIT:

More info on the drone specs:

It is a parrot bebop 2, here is a fairly digestible breakdown of its physical specs: https://www.cnet.com/products/parrot-bebop-drone-2/specs/

It contains a magnetometer inside.

There are alot of different types of data received. None of it is really directly from the sensors themselves, but packaged up in "events" that I can tap into. I think the two pieces of information relevant to this are the "speed" and "attitude" event.

In particular the "yaw" attitude returns the angle between the drones "head" (where the camera is facing) and north. I considered this could be something I could use to calculate the north offset....but in the back of my mind I am thinking what I really need is the angle between the drones centre of gravity itself and north, not the front of the drone. Where I am lacking is a way to formally prove this theory or not.

• Can you explain what sensor data you actually get from your drone? Unless the drone contains a compass, how would it know which way is north? You seem to have come to the same conclusion, as you write "it seems to me that I would actually need to know what direction north is for every subsequent sensor reading". I think the best thing would be to provide what data you actually get, with a (schematic) picture of the drone. – Ingix Jul 18 '18 at 14:25
• I edited my original question with your suggestions, thank you. – rollcona Jul 20 '18 at 12:54
• "I am thinking what I really need is the angle between the drones centre of gravity itself and north" That doesn't make sense to me. An angle is between 2 directions. From any point, north is a given direction and in the close quarters we consider here it doesn't matter if you take north from the camera or the middle or whatever. But the center of gravity is just a point, not a direction. – Ingix Jul 20 '18 at 13:44
• But if the drone can really figure out north/east and up/down indoors, as the magnetometers imply, then it really is as easy as you thought: PosNorth_new = PosNorth_old + SpeedX*(time since PosNorth_old was determined). The hard part is is figuring what is SpeedX when the drone is moving 'forward' and you need to find out which way is forward, in relation to NED. If the drone does that for you, nice! Then you need the attitudes only (if necessary) to show when the camera is pointing at, like "drone is is north-east corner, but looking south". – Ingix Jul 20 '18 at 13:47