-
Notifications
You must be signed in to change notification settings - Fork 2
Created a simulator-GUI that displayed the robot's position when given a log file #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
# Conflicts: # model/src/main/scala/com/lynbrookrobotics/potassium/model/simulations/ui/Canvas.scala # model/src/test/scala/com/lynbrookrobotics/potassium/model/simulations/ui/SimulatorTest.scala
# Conflicts: # model/src/test/scala/com/lynbrookrobotics/potassium/model/examples/SimulatePurePursuit.scala
shadaj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass
| lazy val sharedDependencies = if (System.getenv("NATIVE_TARGET") == "ARM32") { | ||
| Def.setting(Seq( | ||
| "org.typelevel" %%% "squants" % "1.3.0" | ||
| "org.typelevel" %% "squants" % "1.3.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AnkitLakkapragada these should not have been changed; they break our ability to compile to JS and Native.
| publishMavenStyle := true | ||
| publishTo in ThisBuild := Some(Resolver.file("gh-pages-repo", baseDirectory.value / "repo")) | ||
|
|
||
| libraryDependencies += "com.lihaoyi" %% "upickle" % "0.5.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be removed. We have dropped uPickle in favor of Argonaut, which supports all platforms we want to use.
|
|
||
| class Canvas(val w: Int, val h: Int) extends JPanel { | ||
|
|
||
| var xPos: Int = _ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting: no extra lines at beginning, should be initialized to zero.
|
|
||
| ((x * cos - y * sin).toInt, (x * sin + y * cos).toInt) | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra lines
| g.setColor(Color.WHITE) | ||
| g.fillRect(0, 0, w, h) | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra lines
| val simulatorGUI = new SimulatorGUI(Feet(10), Feet(10)) | ||
| simulatorGUI.startGUI() | ||
| simulatorGUI.useLogFile(new File("simlog-,(0.0 ft,0.0 ft,0.0 ft),(-0.1 ft,5.0 ft,0.0 ft),(-5.0 ft,10.0 ft,0.0 ft)")) | ||
| val timer = new Timer() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This timer appears to be doing nothing.
| import com.lynbrookrobotics.potassium.ClockMocking._ | ||
| import com.lynbrookrobotics.potassium.Signal | ||
| import com.lynbrookrobotics.potassium.commons.drivetrain.twoSided.TwoSidedDriveProperties | ||
| import com.lynbrookrobotics.potassium.commons.drivetrain.{ForwardPositionGains, ForwardVelocityGains, TurnPositionGains, TurnVelocityGains} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should not have been changed.
| import com.lynbrookrobotics.potassium.Signal | ||
| import com.lynbrookrobotics.potassium.commons.drivetrain.{ForwardPositionGains, ForwardVelocityGains, TurnPositionGains, TurnVelocityGains} | ||
| import com.lynbrookrobotics.potassium.commons.drivetrain.unicycle.control.purePursuit.{Auto, BackwardsOnly, ForwardBackwardMode, MathUtilities} | ||
| import com.lynbrookrobotics.potassium.commons.drivetrain.unicycle.control.purePursuit.MathUtilities |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, this file should not have been changed.
|
|
||
|
|
||
| } | ||
| }, 0, 100) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems kinda slow. You probably want to update every 1000/60 = 16.7 ms for 60fps rendering.
| */ | ||
|
|
||
| def moveFunction(): Unit = { | ||
| timeSlider.setValue(timeSlider.getValue + 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems arbitrary. You should be running the simulation in real time so the time passed when rendering matches the time passed in the log.
Create a simulator, animating the robot's position and orientation at a certain time using a slider. Also implemented a play button.