Conversation
MatthewCalligaro
left a comment
There was a problem hiding this comment.
Great work! Most of the comments are relatively small specific changes. We can discuss the timeout and image logic refactoring when we call later this week.
| physics_get_angular_velocity, | ||
| physics_get_position, | ||
| drone_get_drone_image, | ||
| drone_get_drone_height, |
There was a problem hiding this comment.
Let's make get_drone_height vs set_height consistent. I'm personally a fan of just drone_get_image and drone_get_height to be concise and avoid repetition.
| /// The time (in ms) to wait for Python to respond. | ||
| /// </summary> | ||
| private const int timeoutTime = 5000; | ||
| private const int timeoutTime = 20000; //changed this from 5000 to 20000 since image processing takes > 5s |
There was a problem hiding this comment.
On the other hand, it is a bad user experience to have something to go wrong and hang 20 seconds before seeing an error. Let's discuss this in person and find a way to keep the timeout at 5 seconds. We should be running at ~60 frames per second, so a 5 second timeout is already extremely generous.
| /// </summary> | ||
| private bool mustUpdateDroneImageRaw; | ||
|
|
||
| private void UpdateDroneImageRaw() |
There was a problem hiding this comment.
There is a lot of duplicated logic between Drone.cs and CameraModule.cs. Can we factor out the duplicate logic into a utils class instead?
| /// The average relative error of position measurements. | ||
| /// This value is made up (it is NOT specified in the Intel RealSense D435i datasheet). | ||
| /// </summary> | ||
| private const float positionErrorFactor = 0.001f; |
There was a problem hiding this comment.
Just wondering: where did you get these numbers from?
| /// The average fixed error applied to all position measurements. | ||
| /// This value is made up (it is NOT specified in the Intel RealSense D435i datasheet). | ||
| /// </summary> | ||
| private const float positionErrorFixed = 0.005f; //old value => 4.90f |
There was a problem hiding this comment.
Where did the old value (4.90f) come from?
| } | ||
|
|
||
| /// <summary> | ||
| /// The position of the car (in meters). |
There was a problem hiding this comment.
Update the summary to clarify "position relative to what"
| { | ||
| if (!this.position.HasValue) | ||
| { | ||
| // Unity uses a left-handed coordinate system, but our API is right-handed |
| public Hud Hud { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Exposes the drone model. |
There was a problem hiding this comment.
Go ahead and move this above the Hud so it is right after the PhysicsModule (to keep the modules together)
| @@ -40,7 +40,7 @@ public class PythonInterface | |||
| /// <summary> | |||
There was a problem hiding this comment.
Above, you need to change private const int version = 1; to 2 because you are updating the communication protocol
Added all new files and modifications to old files for the GPS and drone modules (on the C# side).