Skip to content

RGB Camera ​

PyLoN RGB Camera captures the Flight scene from the camera part's viewpoint and streams RGB images and intrinsics to ROS2. Images include the galaxy background, terrain, clouds, and atmosphere, without the screen UI.

Configure viewing direction, resolution, frame rate, and FOV on the part. Capture load depends on sensor settings, game resolution, and rendering mods. EVE and Scatterer rendering are supported; Scatterer's TAA is not applied to sensor images. Other rendering mods may affect appearance.

The default useGameClipPlanes = true uses the game's near/far rendering range. With false, limit local rendering using nearClipMeters / farClipMeters. Scaled Space and galaxy backgrounds are outside this limit.

Input and output topics ​

DirectionTopicTypeContent
InputNone—No camera control topic from ROS2
Output/ksp_vessel/camera/<camera_id>/image_rawsensor_msgs/msg/ImageRaw RGB image
Output/ksp_vessel/camera/<camera_id>/camera_infosensor_msgs/msg/CameraInfoCamera intrinsics

Image ​

FieldValue
encodingrgb8
is_bigendianfalse
stepwidth * 3
Row orderTop row first
headerSame stamp / frame_id as CameraInfo
bash
ros2 topic hz /ksp_vessel/camera/orbit_camera/image_raw
ros2 run rqt_image_view rqt_image_view /ksp_vessel/camera/orbit_camera/image_raw

CameraInfo ​

Images are generated by a distortion-free pinhole camera.

  • distortion_model = "plumb_bob"
  • d = [0, 0, 0, 0, 0]
  • Focal length is calculated from vertical FOV and image height as height / (2 * tan(vertical_fov / 2)).
  • Principal point is ((width - 1) / 2, (height - 1) / 2).
  • Stereo baseline is zero.
bash
ros2 topic echo --once /ksp_vessel/camera/orbit_camera/camera_info

Defaults and operation ​

The model is a dedicated onboard camera. The mount and side supports are fixed; only the camera body and lens tilt vertically. Set Camera Tilt from 0–180° in the VAB/SPH or Flight right-click menu. The angle is saved in craft/save data. Set the initial angle for new parts with cameraTiltDegrees in ModulePyLoNRgbCamera in part.cfg.

cfg
cameraTiltDegrees = 90
cameraPivotTransformName = CameraPivot
cameraOpticalTransformName = CameraOptical
AngleLens direction (part-local coordinates)
0°+Y: upward along the mounting surface
90° (default)−Z: outward from the mounting surface
180°−Y: downward along the mounting surface

“Up/down” is relative to the part's mounting pose. Rotating the entire mounted part also changes its tilt direction. At 90°, image up is +Y. Capture, preview, and transmitted camera pose all follow the rotated CameraOptical. The bridge sends the optical frame pose at image time as dynamic TF. The model origin is the base mounting surface. Changing the angle in the VAB/SPH updates the body orientation immediately.

SettingDefaultRange
Resolution320 × 240Width 16–1280, height 16–720
frame rate5 Hz1〜15 Hz
Vertical FOV60°20–120°
Use game clip planestrueSet with useGameClipPlanes
Near clip (custom range)0.05 m0.01–10 m
Far clip (custom range)20000 mAt least near + 1 m
Chunk size12000 bytes512–36000 bytes
Maximum frame4 MiB1 KiB–16 MiB

The Part Action Window offers resolution presets of 160 × 120, 320 × 240, and 640 × 480, plus frame rate and FOV controls.

In the VAB/SPH or on the active vessel in Flight, right-click the camera and select Show RGB Preview to open a live preview. Drag its title bar to move it; close with X or Hide RGB Preview in the part menu. The window shows the Sensor ID, allowing multiple camera previews for comparison.

Preview uses the same capture path as Flight UDP streaming and reflects resolution, frame rate, FOV, and Camera Tilt changes. With Camera: On, local preview works even with UDP: Off, without a ROS2 bridge. In the VAB/SPH, it shows the hangar from the camera viewpoint and never transmits UDP. Camera: Off stops the image. F2 hides it with the game UI; vessel switches and scene exit close it.

Set <camera_id> using Edit ROS2 Sensor ID in the VAB/SPH. New parts receive camera_<8-digit UID>, passed to the bridge as UDP sensorId.

Frame ​

Camera frames follow the REP-103 optical convention.

  • +X: image right
  • +Y: image down
  • +Z: camera forward

When connected to the active vessel model, the optical frame is a child camera_optical_frame of the corresponding link. Without a model, the fallback is:

text
<frame_prefix>_<camera_id>_camera_optical_frame

Missing frames ​

A frame missing even one chunk is not published. Incomplete frame assemblies are discarded after two seconds. Sensor topics are removed when --topic-timeout-sec elapses after the last complete frame publication.

Guides and API references for building ROS2 applications with PyLoN