Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

initial docs for sim overhaul [WIP] #283

Merged
merged 26 commits into from
Dec 21, 2023

Conversation

jheidegger
Copy link
Contributor

Converting some internal documentation about setting up the new simulation environment

Would welcome any and all suggestions and improvements!

still todo

  • Transfer over simulation architecture discussion from the deprecated page
  • Remove or segment all AdvantageKit references
  • Convert Code blocks to Remote Literal Include (will need to coordinate with another PR for this)

Copy link
Contributor

@mdurrani808 mdurrani808 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great first article. Took a first pass at this for mainly flow (will do more indepth review later), would be great if we can get @amquake and @mcm001 to review this as well.

source/docs/programming/photonlib/simulation.rst Outdated Show resolved Hide resolved
source/docs/programming/photonlib/simulation.rst Outdated Show resolved Hide resolved
source/docs/programming/photonlib/simulation.rst Outdated Show resolved Hide resolved
source/docs/programming/photonlib/simulation.rst Outdated Show resolved Hide resolved
source/docs/programming/photonlib/simulation.rst Outdated Show resolved Hide resolved
@jheidegger
Copy link
Contributor Author

Just a quick comment the simulation-deprecated was the original documentation that is currently live on the website with the addition of (deprecated) to the title.

I am totally down to edit it but don't know if that is fully in scope for this PR. Just let me know

@mdurrani808
Copy link
Contributor

Just a quick comment the simulation-deprecated was the original documentation that is currently live on the website with the addition of (deprecated) to the title.

I am totally down to edit it but don't know if that is fully in scope for this PR. Just let me know

Forgot that some of that stuff was old docs. Don't bother updating it then besides putting deprecated in parenthesis.

Copy link
Contributor

@mdurrani808 mdurrani808 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amquake pls review

source/docs/programming/photonlib/simulation.rst Outdated Show resolved Hide resolved
source/docs/programming/photonlib/simulation.rst Outdated Show resolved Hide resolved
source/docs/programming/photonlib/simulation.rst Outdated Show resolved Hide resolved
source/docs/programming/photonlib/simulation.rst Outdated Show resolved Hide resolved
source/docs/programming/photonlib/simulation.rst Outdated Show resolved Hide resolved
source/docs/programming/photonlib/simulation.rst Outdated Show resolved Hide resolved
source/docs/programming/photonlib/simulation.rst Outdated Show resolved Hide resolved
source/docs/programming/photonlib/simulation.rst Outdated Show resolved Hide resolved
@amquake
Copy link
Member

amquake commented Sep 20, 2023

Sorry for the late response.

I started reviewing but squirrel-brained and rewrote the simulation page, which I PRed here: jheidegger#1. This links to the updated examples in PhotonVision/photonvision#913, which would mean this pr waits on that. I preferred putting in descriptive code blocks instead of RLIs, hopefully that isn't too much of a maintainability concern. @jheidegger @mdurrani808 Lmk your thoughts

@mcm001
Copy link
Contributor

mcm001 commented Sep 22, 2023

We would prefer RLIs when possible

@mdurrani808 mdurrani808 added this to the beta 2024 milestone Sep 27, 2023
Copy link
Contributor

@mdurrani808 mdurrani808 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left one comment

Copy link
Contributor

@gerth2 gerth2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got through almost everything. Looks real darn solid. Comments are optional/suggestions, feel free to close without resolution.


You can use this to help validate your robot code's behavior in simulation without special wrappers or additional hardware.
Simulation is a powerful tool teams can use to validate their robot code without needing access to a physical robot. Read more about `simulation in WPILib <https://docs.wpilib.org/en/stable/docs/software/wpilib-tools/robot-simulation/introduction.html>`_.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reword sugestion:

Simulation is a powerful tool for validating robot code without access to a physical robot

Fewer words, same meaning.


.. warning:: Not all network tables objects are updated in simulation. The interaction through PhotonLib remains the same. Actual camera images are also not simulated.
With this approach required information about the camera and target properties is straightforward, and users can easily setup and experiment with PhotonLib in simulation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I worry about statements like "X is straightforward" - it can be discouraging if a student is stuck on a problem, sees the line in docs, and then wonders "if it's straightforward, why can't I figure it out?"

I'm assuming the intent of the line is to explain and justify the choice for what is in/out of scope for simulation?

Assuming so.... potential reword:

"This scope was chosen to balance fidelity of the simulation with the ease of setup, in a way that would best-benefit most teams"


A prerequisite for simulating vision frames is knowing where the camera is on the field-- to utilize PhotonVision simulation, you'll need to supply the robot pose periodically. This requires drivetrain simulation for your robot project if you want to generate camera frames as your robot moves around the field.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested addition:

Need to supply the simulated robot pose periodically.


It requires a number of pieces of configuration to accurately simulate your physical setup. Match them to your configuration in PhotonVision, and to your robot's physical dimensions.
A ``VisionSystemSim`` represents the simulated world for the camera, and contains the vision targets it can see. It is constructed with a unique label:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the label be globally unique? Or should it match the pipeline name that's in the real camera?

source/docs/programming/photonlib/simulation.rst Outdated Show resolved Hide resolved
mdurrani808
mdurrani808 previously approved these changes Dec 19, 2023
@mdurrani808 mdurrani808 merged commit bea749d into PhotonVision:master Dec 21, 2023
1 of 2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants