Commit Graph
524 Commits
Author SHA1 Message Date
hba56 d4be901b1a Merge remote-tracking branch 'origin/story31.2' into story31.2 2017-05-14 15:16:18 +12:00
fjc40 2dc17a688f Mock.Polars:
Fixed a bug where duplicate estimates could be added to the Polar table (this happened when the angle was 0, so the "negative" angle became 360, which is equivalent).
Now has a list of angle values for each wind speed, rather than checking if Pair<WindSpeed, WindAngle> exists in the map.
calculateVMG now uses linear interpolation between two adjacent angles (e.g., if data file contains angles 0, 30, 45, etc.. it can interpolate and find an optimal VMG angle between those, for example, 17 degrees).
Added a third test for when we provide a wind speed which is lower than any wind speed values in the Polars table. Still need to actually calculate correct VMG values by hand.

#story[873]
2017-05-14 01:12:36 +12:00
fjc40 6f9249e238 Mock.PolarParser. Fixed a bug where it would only parse the first half of each row.
Mock.Polars. addEstimate also builds up a unique list of angles from the data file, instead of dynamically generating that when calculating a VMG.
addEstimate also adds estimates with negative angles (e.g., 45deg+windSpeed+boatSpeed, and -45deg+windSpeed+boatSpeed).
calculateVMG now accepts an upper and lower bounds to the allowed VMG bearing it returns - this way you can get VMGs only within a certain angle interval (e.g., [16, 99] degrees).
Also fixed some bugs in calculateVMG where it wasn't actually using the angles and such correctly.
Improved the test case slightly, but still need to calculate correct values by hand.

#story[873]
2017-05-13 17:10:06 +12:00
hba56 dd1308808a updated the race class to set heading based on the vmg not just the end of a leg
-race class now stores the boundary
-updatePositions now checks if the boat is with the course
-update positions now sets heading and speed based on the vmg
-updated azimuth to now accept a start and finish gps rather that finding it itself
-added a calculatebearingtodestination method that finds the azimuth to the dest from the boat
-updated boat tests to use the new azimuth method
 #story[873]
2017-05-12 12:49:02 +12:00
Joseph Gardner 04fdeaf2e2 Optimised boundary checking #story[873] 2017-05-12 11:58:31 +12:00
Joseph Gardner eca6b7e374 Fixed imports 2017-05-11 15:57:54 +12:00
Joseph Gardner 602bc0686e Changed public functions in the RaceXMLReader to make a new list every time and reassign the list to avoid duplicates in a list. #story[873] 2017-05-11 14:55:50 +12:00
Joseph Gardner 8c0c03dcf2 Fixed tests that were reading the file again making them fail. #story[873] 2017-05-11 14:49:17 +12:00
Joseph Gardner a13899b6a7 Implemented and tested to check if a point is inside or outside of a boundary using a ray tracing algorithm. The function is public static for a GPSCoordinate and takes a list of GPSCoordinates and the comparing coordinate. #story[873] 2017-05-11 14:40:24 +12:00
fjc40 3b2f99b7d7 Fixed Polars.calculateVMG function - it was using non-existent keys in some circumstances.
#story[873] #pair[fjc40,jam339]
2017-05-11 11:58:02 +12:00
fjc40 238b97c016 Added a VMG class (has a speed and bearing).
Added the Polars.calculateVMG function, which calculates the VMG from a given wind angle, wind speed, and angle to destination. In may not be completely correct at the moment, so it's a work in progress.

#story[873]
2017-05-11 11:30:18 +12:00
fjc40 693da8a82a Removed some unneccessary code and comments from PolarParser.parse(...).
Fixed a bug where the polar parser would attempt to insert (wind speed, windspeed, windangle) instead of (windspeed, windangle, boatspeed).
Removed some unused constructors from RaceXMLReader, and fixed a bug where it wouldn't actually use the polar table correctly.
Boat's constructor now expects a Polars table.
Added some comments to the Polars class, and specified the HashMap's template parameters
Added PolarsTest - which needs to be implemented properly when the VMG calculations have been added.

#story[900]
2017-05-10 17:21:18 +12:00
hba56 4f8d6b14d4 updated app class to read the polar csv and pass it off to its parser
#story[900]
2017-05-10 15:46:01 +12:00
hba56 245914a69e added the polars csv
#story[900]
2017-05-10 15:26:43 +12:00
hba56 e67f8fae4b parser updated for the hashmap polars
#pair[hba56, fjc40]
 #story[900]
2017-05-10 15:24:46 +12:00
fjc40 1434892b51 Merge branch 'story31.1' of eng-git.canterbury.ac.nz:seng302-2017/team-7 into story31.1 2017-05-10 15:12:06 +12:00
fjc40 aeee8ca748 Added polar data file.
Added PolarParse class - currently commented out as it depends on polar table class.

#story[900]
2017-05-10 15:11:51 +12:00
hba56 f518c52c7b changed the way we store polars
-removed polar class
-added in new hasmap polars class
-updated boat class to the changes
 #story[900]
2017-05-10 15:10:03 +12:00
hba56 1f554648ef changed all polar values to doubles and added a empty constructor
#story[900]
2017-05-10 14:41:05 +12:00
hba56 a4480f3ccf removed the get best heading method as it was incorrect and not related to this story
#story[900]
2017-05-10 14:25:06 +12:00
hba56 d7294f73a1 boats now have polars stored in the
-added getter and setter for a boats polars

 #story[900]
2017-05-10 14:23:26 +12:00
hba56 5b010cad49 added the polar class for storing polars
#story[900]
2017-05-10 13:45:09 +12:00
hba56 187acc6960 added an empty polarparser class to push a new branch
#story[900]
2017-05-10 12:30:46 +12:00
Jessica McAuslin 43757b34d1 General code tidy up (Visualiser)
- access modifiers adjusted
- unused declarations removed
- spelling fixes
- removed redundant code
2017-05-08 20:45:00 +12:00
Jessica McAuslin 2d983eccfd General code tidy up
- access modifiers adjusted
- unused declarations removed
- spelling fixes
- removed redundant code
2017-05-08 20:21:20 +12:00
Joseph Gardner e1ba2ae5b6 Now reads course wind direction from the live stream, so the wind arrow now changes when the wind changes. #story[882] 2017-05-08 17:23:55 +12:00
fjc40 a32775eab6 Fixed a few javadoc issues. 2017-05-08 10:59:13 +12:00
fjc40 b247244665 Did some large tidy ups, refactoring, and documenting.
Network:
Moved the Network message classes from the Utils package to the Messages package.
Renamed BoatLocationMessage to BoatLocation and BoatStatusMessage to BoatStatus to be consistent with other message classes.
Renamed the BoatStatus enumeration to BoatStatusEnum as it conflicted with BoatStatus (the message).
Moved the BoatStatusEnum and MessageType enumerations from the Utils package to the Messages/Enums package.
Changed the BoatStatusEnum and MessageType enumerations to use map look ups in the enum.fromByte(b) method - this means that there's less copy and pasted values, and the fromByte function doesn't need to be modified if new enumerations are added.
Added a sequenceNumber member to the Heartbeat class.
Added an InvalidMessageException in the package Networking/Exceptions. This is thrown when a message is read, but it is invalid in some way.
Refactored/tidied up the Networking/BinaryMessageEncoder and Decoder classes. The decoder throws InvalidMessageExceptions instead of returning null.

Visualiser:
VisualiserInput now wraps a DataInputStream around the socket. This provides the stream.readFully(buffer) function, which is a blocking read, removing the need for busy wait loops. Replaced the getBytes() function with getNextMessage() and getNextMessageBytes(). These read the next message from the socket, and return it as a message object and a byte array, respectively.
Changed the current heartbeat timeout to 10 seconds. Added some work-in-progress code to attempt to reconnect when connection is lost. It currently doesn't work. I think Fan-Wu was doing a proper implementation, however.
VisualiserInput also has a queue of received events. Currently not really used, but could be useful in the future. Events get added as they are read.
Changed VisualiserInputs main loop to use instanceOf instead of switch+case. Feedback wanted - are there any downsides to using this instanceOf method?

#story[778,782]
2017-05-08 03:29:33 +12:00
fjc40 466e22437b Visualiser. The nullptr issues relating to the XML data files appears to be fixed. Essentially, the StartController.startRaceNoScaling() function was being called as soon possible, before it was even ready - setRaceClock either hadn't been called or hadn't finished executing yet, so the StartController.raceClock member was null, causing crashes.
Also changed the while(visualiserInput.getRaceStatus() == null) loops to an if-then-return early block. They caused the program to freeze if the race data source wasn't sending any race status messages (currently, our mock doesn't send any once the race has finished).

#story[782]
2017-05-07 18:34:44 +12:00
fjc40 020c0329b0 Merge remote-tracking branch 'origin/TCPDisconnection' into submission 2017-05-07 16:55:07 +12:00
fjc40 83ce9b99d2 Mockoutput's main loop now pops messages off the message queue, rather than iterating over it like an array, and clearing it (this could have threading issues where the iteration starts (with e.g., 5 messages), as it is sending the messages another one is added, and then it ends up clearing the sent messages, and the unsent message.
Made a few quick fixes (to be tidied a bit later) to Mock.Race class. It now has this.startTime, instead of the AnimationTimers having their own starTime value. RaceStatus messages are now sent properly (still need a refactor though), so they actually send the race star time - this means that the visualizer using the mock data source displays the correct time instead of (midnight, jan 1, 1970).

Removed one of the constructors from RaceStatus - it allowed for constructing and sending essentially invalid RaceStatus messages, and simply wasn't needed.

Added a temporary title ("RaceVision - Team 7") to the visualiser - may be worth changing when we decide on a team name.

Fixed a bug with the order of operations in visualiser.StartController.countdownTimer(). Calling begin race before hiding panes caused them to never be hidden.

Mock.Event. Changed the scaleFactor to 5x for the time being - to easier testing of things like pre-race timers, countdowns, etc...

#story[778,782]
2017-05-07 15:52:34 +12:00
fjc40 01224c509a Added some comments to MockOutput. Also removed instance of RaceVisionByteEncoder, as it has no state, and the functions used are all static. 2017-05-07 14:43:11 +12:00
fjc40 3481a882de Fixed Team Oracle's boat name in mock data file.
#story[778]
2017-05-07 14:28:31 +12:00
David Wu 61ecdc2269 Merge branch 'submission' of https://eng-git.canterbury.ac.nz/seng302-2017/team-7 into submission
# Conflicts:
#	visualiser/src/main/java/seng302/Controllers/MainController.java
#	visualiser/src/main/java/seng302/Controllers/StartController.java
#	visualiser/src/main/java/seng302/Model/Race.java
2017-05-06 20:23:01 +12:00
David Wu 61afe8d608 Created finish view to see when a race finishes.
-Implemented FinishController
-Fixed mock not sending Finish race status.

#Story[782]
2017-05-06 20:14:10 +12:00
cbt24 c038010bd2 Draws track for racing boats only to reduce information clutter.
- Add track point only when boat status is "Racing"

#story[782]
2017-05-06 19:22:20 +12:00
cbt24 f27dbc29b0 Added self-documenting RaceStatus boolean getters
- Deprecated RaceStatus.getRaceStatus

#story[782]
2017-05-06 19:06:37 +12:00
cbt24 cc824aa89a Removed unnecessary countdownTimer from Race in visualiser module
- Run method now calls simulateRace directly

#story[782]
2017-05-06 18:20:41 +12:00
cbt24 a6adfb4960 Refactored RaceClock to act as central source of time and duration information throughout visualiser.
- StartController and RaceController use same RaceClock instance
- RaceClock updates automatically as Runnable for consistent operation
- Duration between starting and current time is now an observable property of RaceClock

#story[782]
2017-05-06 18:02:48 +12:00
Fan-Wu Yang bdf215d0f1 TCP connection at the front menu will no longer bug out if the socket is bugged.
- Timeout set on connection socket so that the socket will return false after 5 seconds.
#story[782]
2017-05-06 16:55:12 +12:00
David Wu a95a0c2543 Added documentation for multiple classes.
#Story[782]
2017-05-06 16:39:15 +12:00
hba56 12e457824d fix for issue #5 gate lines
-removed drawing of lines between the marks as only the start and finish line should have a line drawn

 #story[782]
2017-05-06 16:31:40 +12:00
Fan-Wu Yang d52b09e74a Visualiser Closes All threads on exit now.
- Added override for exiting the Visualiser which closes all threads: such as the TCP connection.
#story[782]
2017-05-06 15:58:12 +12:00
Fan-Wu Yang a20dafea11 Annotations go on top and boundaries now update
- Fixed FPS and other annotations being hidden under the map
- Fixed boundaries not updating with the visualiser.
#story[782]
2017-05-06 15:46:38 +12:00
Fan-Wu Yang 982b47943a Fixed blocking issue
- Fixed byte stream error where it would reinitilise every run
#story[782]
2017-05-06 15:27:21 +12:00
Fan-Wu Yang b7f010a2fa Fixed Network While loops
- Removed while blocking loops and replaced them with return statements
#story[782]
2017-05-06 14:36:37 +12:00
Fan-Wu Yang 565b7adaa2 Merge remote-tracking branch 'origin/race-timer-fixes' into layeredCanvas
# Conflicts:
#	visualiser/src/main/java/seng302/Controllers/StartController.java
2017-05-04 16:55:01 +12:00
Fan-Wu Yang 862391d7ef Canvas Layer Created
- Canvas is created via layering.
- Resizable canvas is now a seperate abstract class
#story[782]
2017-05-04 16:54:06 +12:00
cbt24 349bd50094 Everything works, don't ask questions
#story[782]
2017-05-04 16:52:33 +12:00
Erika Savell 62db7f333c Frantically cherry-picking commit by commit
#story[778]
2017-05-04 16:33:07 +12:00