Styling and sheep behaviour

This commit is contained in:
Johnny Fernandes
2026-04-22 21:01:42 +01:00
parent 79e4a3e698
commit f256e99a76
8 changed files with 2122 additions and 5 deletions
+22
View File
@@ -0,0 +1,22 @@
"""
Viewpoint inspector — prints position, orientation and FOV to the console
once per second. Attach as the controller of a dummy supervisor robot to
copy-paste exact camera values into field.wbt.
"""
from controller import Supervisor
robot = Supervisor()
timestep = int(robot.getBasicTimeStep())
vp = robot.getFromDef("VIEWPOINT")
step = 0
while robot.step(timestep) != -1:
if step % 60 == 0:
pos = vp.getField("position").getSFVec3f()
ori = vp.getField("orientation").getSFRotation()
fov = vp.getField("fieldOfView").getSFFloat()
print(f"position: {pos[0]:.3f} {pos[1]:.3f} {pos[2]:.3f}")
print(f"orientation: {ori[0]:.3f} {ori[1]:.3f} {ori[2]:.3f} {ori[3]:.3f}")
print(f"fieldOfView: {fov:.3f}\n")
step += 1