robotpy / robotpy-docs

Unified documentation for RobotPy
Apache License 2.0
10 stars 25 forks source link

User physics module does not have a PhysicsEngine object Error #64

Closed yusufkurt77 closed 7 months ago

yusufkurt77 commented 7 months ago

Problem description

when i tried to run this code i encountered with "User physics module does not have a PhysicsEngine object" error.

Operating System

Windows

Installed Python Packages

bcrypt                    4.0.1
cffi                      1.16.0
click                     8.1.7
colorama                  0.4.6
coverage                  7.3.2
cryptography              41.0.5
iniconfig                 2.0.0
packaging                 23.2
paramiko                  3.3.1
Pint                      0.22
pip                       23.3.1
pluggy                    1.3.0
pycparser                 2.21
pyfrc                     2023.0.1
PyNaCl                    1.5.0
pynetconsole              2.0.4
pyntcore                  2023.4.3.0
pytest                    7.4.3
pytest-reraise            2.1.2
robotpy                   2023.4.3.1
robotpy-apriltag          2023.4.3.0
robotpy-commands-v2       2023.4.3.0
robotpy-cscore            2023.4.3.0
robotpy-ctre              2023.1.0
robotpy-hal               2023.4.3.0
robotpy-halsim-gui        2023.4.3.0
robotpy-installer         2023.0.4
robotpy-navx              2023.0.3
robotpy-pathplannerlib    2023.3.4.1
robotpy-photonvision      2023.4.2
robotpy-playingwithfusion 2023.1.0
robotpy-rev               2023.1.3.2
robotpy-wpilib-utilities  2023.1.0
robotpy-wpimath           2023.4.3.0
robotpy-wpinet            2023.4.3.0
robotpy-wpiutil           2023.4.3.0
setuptools                65.5.0
typing_extensions         4.8.0
wpilib                    2023.4.3.0

Reproducible example code

Link that i gave at problem description.
virtuald commented 7 months ago

Generally you don't run the physics module, you run robot.py... which works for me? Can you provide the full command you executed, the full error message, and the full stack trace?

yusufkurt77 commented 7 months ago

I run "py -3 robot.py sim" command on terminal. There is robot.py code i tried to run. Full error: 12:32:56:406 INFO : wpilib : WPILib version 2023.4.3.0 12:32:56:407 INFO : wpilib : HAL version 2023.4.3.0 12:32:56:407 INFO : wpilib : Running with simulated HAL. 12:32:56:407 INFO : wpilib : pyntcore version 2023.4.3.0 12:32:56:408 INFO : wpilib : robotpy-apriltag version 2023.4.3.0 12:32:56:408 INFO : wpilib : robotpy-commands-v2 version 2023.4.3.0 12:32:56:408 INFO : wpilib : robotpy-cscore version 2023.4.3.0 12:32:56:408 INFO : wpilib : robotpy-halsim-gui version 2023.4.3.0 12:32:56:408 INFO : wpilib : robotpy-wpimath version 2023.4.3.0 12:32:56:408 INFO : wpilib : robotpy-wpinet version 2023.4.3.0 12:32:56:409 INFO : wpilib : robotpy-wpiutil version 2023.4.3.0 12:32:56:409 INFO : wpilib : robotpy-photonvision version 2023.4.2 12:32:56:409 INFO : wpilib : robotpy-pathplannerlib version 2023.3.4.1 12:32:56:409 INFO : wpilib : robotpy-rev version 2023.1.3.2 12:32:56:409 INFO : wpilib : robotpy-ctre version 2023.1.0 12:32:56:409 INFO : wpilib : robotpy-playingwithfusion version 2023.1.0 12:32:56:409 INFO : wpilib : robotpy-navx version 2023.0.3 12:32:56:412 INFO : halsim_gui : WPILib HAL Simulation 2023.4.3.0 HAL Extensions: Attempting to load: halsim_gui Simulator GUI Initializing. Simulator GUI Initialized! HAL Extensions: Successfully loaded extension 12:32:56:575 ERROR : pyfrc.physics : User physics module does not have a PhysicsEngine object

virtuald commented 7 months ago

That example definitely works, it seems like maybe the contents of the example have been corrupted on your machine? Have you opened physics.py to verify that the contents are identical to the example?

Please provide a SHA1 hash of the files (robot.py and physics.py) on your machine so we can verify that they are not corrupted. On Windows, you can do this via certutil -hashfile FILENAME.

yusufkurt77 commented 7 months ago

robot.py hashfile: 22e201b092a1686e64f378896be62e1c841ad669 physics.py hashfile: 07ccfe9ae322c8f5fd205188297b785bc7732f67

yusufkurt77 commented 7 months ago

These are the full code. Screenshot 2023-11-13 204325 Screenshot 2023-11-13 204401

Screenshot 2023-11-13 204415

virtuald commented 7 months ago

The robot.py code doesn't match the example you provided, and I get different hashes:

$ sha1sum *
4997d11b0a3e58248ac93e08b9175cfff7a5637b  physics.py
88b6b7f176291bf1071877e0159b883d7085182a  robot.py

But with that said, the code you provided looks correct, so there must be something really weird going on here -- maybe a newline thing, or a odd unicode character somewhere?

Can I ask you to directly download the example from https://github.com/robotpy/examples/archive/refs/heads/main.zip, and then try to run that?

yusufkurt77 commented 7 months ago

I dont know what causes problem exactly but when i tried again this time it worked.

virtuald commented 7 months ago

Glad to hear it!