What is the time unit returned by dji.common.mission.waypoint.Builder.calculateTotalTime() - dji-sdk

Unfortunately, DJI SDK documentation only states:
Calculate the total time of the waypoint list.
Is that in seconds? Seconds' fraction? Minutes?
The same applies to Builder.calculateTotalDistance():
Calculate the total distance of the waypoint list.
I couldn't deduce the right time (and distance) units since I got different values for the same set of waypoints in different map locations (!). For instance, the same equally spaced waypoints in middle-east Brazil is different when they're applied in north-west of Canada. The difference is ~15%. What's the reason?
My SDK version is 4.13.1 for Android (MSDK).

I've e-mailed them through dev#dji.com and they've answered that the distance is in meters and the time, in seconds.
About the different values for middle-east Brazil and the north-west of Canada, I have no clue.

About the geographical variations, 1 degree of longitude at the equator is much bigger (in meters) that 1 degree close to the north pole. Sounds right what you observed.

Related

Units of velocity in Pymunk

I was wondering what the basic units of velocity are in Pymunk. If I put in a velocity of (50,50) does that correspond to 50 pixels/second in each direction? The API says that the units of angular velocity are rad/s but doesn't say anything about linear velocity.
Thanks.
Chipmunk avoids enforcing any particular units or scales. If you are using pixels for distance, and seconds for time, then velocity is in pixels per second. If you want to use meters and hours that’s fine too. As long as you drive it with the right input and interpret the output correctly you are good.

DJIWaypointMissionHeadingTowardPointOfInterest, but the gimbal pitch angle?

using DJIWaypointMissionHeadingTowardPointOfInterest as heading mode in DJIWaypointMission i can automatically rotate the drone to heading vs a POI, but is there a way to also automatically tilt the camera to frame the POI?
(unlucky also the "pointOfInterest" have no altitude property)
also i think that would be better change/define the heading mode in the DJIWaypoint instead to be a property of the entire DJIWaypointMission, is it possible?
I'm adding to what Ken said.
When you use 'isGimbalPitchRotationEnabled' you can set a pitch angle in each waypoint. The drone will change the pitch angle in a linear motion between each 2 waypoints.
Of course this will not work when during a flight between the 2 points the drone gets closer to the POI and than backs away.
What I'm doing in my app is dividing the straight line between the 2 points into several straight sections and calculating the correct pitch at each point. As I divide the original line I calculate the error (the difference between the calculated pitch and the linear extrapolated pitch). If the error is greater than some value (5 degrees, for example) I divide the line recursively and re-calculate the pitch, until the error at each point is small enough. It takes some geometric calculations when preparing the mission, but it produces amazing fly-by shots.
Take a look at these settings:
isGimbalPitchRotationEnabled and gimbalPitch
This isn't a 'true' location though because the pitch divides equally based on the distance between the waypoints but it's close.
In my app I manually control the gimbal but that means a connection must be maintained or the gimbal stops moving.
Yes, it would be nice if the POI in waypoints was a true POI functionality and I've made the suggestion many times but to no avail so far. I'd like to see the POI be a per waypoint (as a LocationCoordinate 3D) rather than the current, 1 POI for the whole mission.
I'd also like to see the location in waypoint to be consistent and be of type LocationCoordinate3D.

DJI Mobile SDK - how is distance between adjacent waypoints calculated?

Using the DJI Mobile SDK to upload Waypoint Missions, if two adjacent waypoints are determined by the DJI to be too close (within 0.5 meters), the upload is rejected.
Does anyone know the algorithm used to determine the distance between adjacent waypoints in a waypoint mission?
Specifically, is the DJI algorithm using a haversine calculation for distance between lat, lon coordinates and if so, what is the earth radius used? Is it the UIGG mean radius: 6371008.8 meters. Or some other radius?
Or does it use the ellipsoidal Vincenty formula (WGS-84)?
This information would be useful for more precise waypoint decimation prior to mission upload.
First off, I would comment that DJI answering an internal implementation question is very unlikely since it would expose them to having to support the implementation over time and across aircraft. Different aircraft, different technologies may result in varying implementations.
What has always worked for me it to use standard "distance between points" calculations, either common from map formulas or as built into platform SDK (iOS, Android, etc.) I have found these to be sufficiently accurate enough to plan even complex flights.
Based on several tests I can now confirm that the current DJI internal distance computation is dependent on latitude and/or longitude. Meaning that you will get different results for the same (!) waypoint distance pair depending on where your two points are anchored.
A 1.5-meter distance Waypoint Pair got accepted as a mission in a location in central Europe but were rejected with WAYPOINT_DISTANCE_TOO_CLOSE for a location in the central US.
(We verified with https://gps-coordinates.org/distance-between-coordinates.php that both waypoint distance pairs had the same 1.5 meter distance between them.)
So it's safe to assume that DJI has a bug in their distance calculation.

How to get FLIGHT time between two locations using the Google Maps Distance Matrix API?

I need to get travel time by plane between two locations.
In Distance Matrix API there is no Travel Mode like "flight" - https://developers.google.com/maps/documentation/javascript/distancematrix#travel_modes
Any suggestions?
Unfortunately there is no easy way to do this.
However, you could do a trick and estimate the flight time by using geocoding and the geometry library. At least if you don't need real flight data.
The steps would be:
Transform origin and destination from String to LatLng (Geocoding API)
Create markers for each location. (Geometry lib)
Calculate airline distance using computeDistanceBetween (like this: google.maps.geometry.spherical.computeDistanceBetween(path1, path2))
Calculate approximate flight time using average airplane speed.
Hope this helps.
This is sort of a work-around, but an easy one.
Use the measure distance tool in google maps, then for flight time of regular commercial airliners, divide the distance in miles by 500mph to get flight time in hours. For a small propeller plane (like a cessna), use 165mph.

Which algorithm or method used for modeling the behavior of vehicles at an intersection

My first post here – hoping you can help me,
I want to design the intersection Traffic light simulation , I have data about number of vehicles every traffic light phase, and I already counting the length of the cycle lights on,
BUT I didn't know which algorithm can be used for modelling the traffic behavior
I am looking for an algorithm for such cases :
A. Number of vehicles data : (example)
North Path : 40 - 55 vehicles
South Path : 70 - 85 vehicles
East Path : 50 - 65 vehicles
West Path : 50 - 70 vehicles
I want to modelling the number of vehicles that appear in simulation on every path based on value of the random interval value
B. Direction of movement : (example)
North to South : 16 - 20 vehicles
North to West : 10 - 15 vehicles
North to East : 14 - 20 vehicles
and so on
Behaviors of every direction of vehicle movement use AI algorithm based on value of the random interval value
C. Behaviors :
The vehicle begins to slow down before stop if there is a vehicle in front of it or the red light is on
the vehicle will move to smaller queues than the queue in front of it
Have space between vehicles
using acceleration to the initial movement, and speed will be constant after that
If you're not sure where to start, you're probably going to need to start with some slightly simpler problems that you can combine together to get you to a final solution.
Perhaps the best place to start would be by trying to predict how many cars arrive at a light in one cycle? In such a case, you're going to need to know something about probability distributions and for low numbers that need to greater than or equal to 0, poisson distributions specifically.
If you're trying to predict which choice may be made by the driver of a car sitting at any given set of lights, based on measurements, the easiest approach may be to generate a discrete probability distribution (if drivers choices are uncorrelated) or Markov Chains (if they are correlated).
If you're trying to work out how single lights change colour (Green -> Amber, Amber -> Red, Red -> Green), you could model that as a State machine.
If you're trying to manage multiple sets of lights, particularly when those transitions can be driven by asynchronous events, your best bet is something like a discrete event simulation. If you're looking for a more formal description of the system as a whole you may need to move to Petri nets
If you care about the positions of the individual cars you may be able to model their positions (and transitions between positions) on a graph, where vertices are associated with a location. If you need to incorporate detailed information about geometry, dynamics, kinematics you are going to need detailed models of the cars and their interactions with the road surface (and potentially each other). This would be important if you wanted to model crashes within an intersections.

Resources