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

Fix camera and projector extrinsics in 3dScene #183

Merged
merged 3 commits into from
Aug 27, 2024
Merged

Conversation

pascalzauberzeug
Copy link
Contributor

@pascalzauberzeug pascalzauberzeug commented Aug 27, 2024

Cameras in a 3dScene weren't moving correctly with the new transformation changes. This PR fixes both the camera and the camera projection movement, and adds the update interval as a parameter.

Here is an example to test both:

import math

import rosys
from nicegui import ui
from rosys.driving import Odometer, Steerer, joystick, keyboard_control, robot_object
from rosys.geometry import Prism
from rosys.hardware import RobotSimulation, WheelsSimulation
from rosys.vision import CameraProjector, SimulatedCalibratableCamera, camera_objects

shape = Prism.default_robot_shape()
wheels = WheelsSimulation()
robot = RobotSimulation([wheels])
odometer = Odometer(wheels)
steerer = Steerer(wheels)
camera_provider = rosys.vision.SimulatedCameraProvider()
camera_provider.remove_all_cameras()
camera = SimulatedCalibratableCamera.create_calibrated(id='Camera', roll=math.pi / 2, frame=odometer.prediction_frame)
camera_provider.add_camera(camera)
camera_projector = CameraProjector(camera_provider)
keyboard_control(steerer)
joystick(steerer, size=50, color='blue')
with ui.scene():
    robot_object(shape, odometer)
    camera_objects(camera_provider, camera_projector)

ui.run(title='RoSys')

@pascalzauberzeug pascalzauberzeug added the bug Something isn't working label Aug 27, 2024
@pascalzauberzeug pascalzauberzeug added this to the 0.15.1 milestone Aug 27, 2024
@pascalzauberzeug pascalzauberzeug marked this pull request as ready for review August 27, 2024 15:33
rosys/vision/camera_projector.py Outdated Show resolved Hide resolved
@falkoschindler falkoschindler merged commit 8321a69 into main Aug 27, 2024
4 checks passed
@falkoschindler falkoschindler deleted the fix_3d_camera branch August 27, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants