Skip to content
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

Using Multiple Cameras Python Documentation is Incomplete #2624

Closed
jonathandao0 opened this issue Apr 1, 2024 · 4 comments · Fixed by #2625
Closed

Using Multiple Cameras Python Documentation is Incomplete #2624

jonathandao0 opened this issue Apr 1, 2024 · 4 comments · Fixed by #2625

Comments

@jonathandao0
Copy link

I was a CSA helping a team at an event this weekend and had a team request for help getting two Microsoft Lifecam HD3000 USB camera streams up on a roboRIO using Python. I managed to get it working after about an hour, but found that this cannot be done with the current steps as written on frc-docs and would be difficult for most people to figure out without prior knowledge of robotpy.

A few things I noted:

  • There is no default way to run multiple cameras directly from robot code (e.g. In Java, you can call CameraServer.startAutomaticCapture(0) and CameraServer.startAutomaticCapture(1) to start two cameras). The Python Using Multiple Cameras documentation calls for creating a vision.py file that is then called from the robot code using wpilib.CameraServer.launch("vision.py:main"). As a result, you need to download robotpy-cscore and install it on the roboRIO (This isn't currently documented on frc-docs).
    • Being able to start multiple cameras from robot code should really be changed in robotpy to allow for this.
  • robotpy-cscore is not automatically installed with the default python installation instructions (py -3 -m pip install robotpy) and must be installed separately with py -3 -m robotpy installer download robotpy-cscore and then py -3 -m robotpy installer install robotpy-cscore when connected to the roboRIO. There should be a warning under the Python examples to alert users of this and to direct them to steps on how to install robotpy-cscore on the roboRIO. (The only reference I could find at the time was from a Google search that pointed to the old robotpy-cscore documention, which still needed to be modified).
  • Unlike C++/Java, there is no deploy directory which confused me a bit when reading the Python Using Multiple Cameras documentation, as I was unsure of where to put the vision.py file. The vision.py can just exist on the root directory of the Python project and will get deployed to the robot code automatically when running the default deploy command (py -3 -m robotpy deploy), which should be noted in the Python vision examples.
    • In general, a "Differences between C++/Java vs Python" page would be useful.
  • Running the vision.py file in the Python Using Multiple Cameras example on the roboRIO v1 will crash with only the error message "exit code 6" in the DriverStation logs (Forgot the exact text). This is a result of memory issues on the roboRIO v1, which is currently only mentioned as an issue here, with the workaround of disabling the NI webserver.
    • The roboRIO v1 memory issues in general should also be noted in the Known Issues page.
@virtuald
Copy link
Member

virtuald commented Apr 1, 2024

The correct way to install cscore on the roborio is to add it to your pyproject.toml (as mentioned in the docs @ https://docs.wpilib.org/en/stable/docs/software/python/pyproject_toml.html).

However, you're right that it probably should be mentioned in the docs somewhere more explicitly. Eventually I want the QuickVision example and other examples to have pyproject.toml files in them so you can just download and go, but... life.

@virtuald
Copy link
Member

virtuald commented Apr 1, 2024

The Python Using Multiple Cameras documentation calls for creating a vision.py file that is then called from the robot code using wpilib.CameraServer.launch("vision.py:main")

So the documentation says "robot.py contents", file content, followed by "vision.py contents", file content... since it wasn't clear to you that the two files lived in the same directory, how would you change the wording to communicate that?

@virtuald
Copy link
Member

virtuald commented Apr 1, 2024

Please review #2625 and see if that addresses your concerns.

@jonathandao0
Copy link
Author

Looks good to me. Thanks for the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants