Changelog: v2.20
v2.20.0 (unreleased)
RaiSim
- Cameras take OpenCV lens models:
plumb_bob(Brown-Conrady) andrational_polynomialdistortion with prism and tilt terms on pinhole cameras, besides the equidistant fisheye, so a calibration from OpenCV, Kalibr, COLMAP or a ROSCameraInfocan be used as it is. Explicitfx,fy,cx,cyare honoured by the CPU rays and by rayrai (an off-centre principal point renders through an off-axis frustum). Pixels beyond the fold of a strong distortion have no ray and no return, and directions at or beyond the fold have no pixel, so a point outside the field of view is never imaged inside it. New:CameraLensModel::setOpenCvPinhole(),setModel(),CameraPinholeDistortion,cameraMatrix(),cameraDistortionCoefficients(),cameraPixelToRay(),cameraRayToPixel()andCameraLensInverse, which prepares the inverse of one lens for many points (where the lens folds,foldLimit(), and how far its image reaches, found once;undistort(),pixelToRay(),rayToPixel()), so a 752x480 ray table of a strong barrel lens takes 110 ms instead of 813 ms, and one of the EuRoC camera's lens 61 ms, where OpenCV'sundistortPointsIter()takes 192 ms for the same pixels; URDF<lens>,<intrinsics>and<distortion>take named coefficients or adlist. The forward model matches the pixels of OpenCV'scv::projectPointsandcv::fisheye::projectPointsfor every coefficient to 1e-6 px (new teststestCameraLens, among themCameraLens.ForwardModelMatchesOpenCvandCameraLens.DirectionsBeyondTheFoldHaveNoPixel, andtestSensorModelXml). See Camera lens models and Mapping pixels and rays. - Behaviour change: explicit
cxandcyare OpenCV pixel coordinates; a fisheye camera with explicitcx,cytherefore moves by half a pixel against earlier versions. An unknown lens model name is a fatal error (it silently became a pinhole). CPU fisheye cameras applyk1tok4, which only rayrai applied, and pixels outside the image circle (half the horizontal field of view, at most 89.5°) have no return (CameraLens.CpuRayTableFollowsTheLens,CameraLens.FisheyeRaysEndAtTheImageCircle). A pinhole camera whose URDF or sensor XML lens elements give nonzerok1,k2ork3is now distorted asplumb_bob, and one with a nonzerok4asrational_polynomial; RaiSim 2.19.0 stored these values as fisheye coefficients without effect on a pinhole image. World XML files that 2.19.0 exported with such coefficients load with a warning and without them, so their cameras see what they saw (SensorModelXml.Version2190WorldXmlPinholeCamerasDropTheirFisheyeCoefficients). - Rolling shutters: the
shutterproperty of every camera (CameraShutter, URDF<shutter type="rolling" readout_time=...>, or Kalibr'sline_delay) times each row from the exposure start of the first, which stays the capture's timestamp. rayrai renders it inbands(16 when 0), each at the time of its middle row, so a row is timed up to half a band's readout time off; selecting theRAISIMray-cast source for a rolling-shutter camera is a fatal error. See Rolling shutter. - Capture latency: RGB, depth, segmentation, normal and optical-flow cameras and spinning LiDARs take
latencyandlatencyJitter. A capture is delivered in order at the first physics step after its delay, inWorld::integrate()for every measurement source, and byRaisimServerfor the cameras of its visual articulated systems, whichWorld::integrate()does not step;getUpdateTimeStamp()is the acquisition time of the delivered capture,getDeliveryTimeStamp()when it arrived. Writers fill the newgetCapture...()buffers and callcommitCapture(); at most 256 captures wait (getDroppedCaptureCount()), and checkpoints keep them. Without latency the buffers are written in place as before (new teststestSensorLatencyandCameraModelProtocol.VisualSystemRepliesAreDeliveredAfterTheCameraLatency, benchmarkcapture_latency). See Capture latency. - Active stereo depth cameras:
DepthCameraProperties::depthModel = ACTIVE_STEREOmodels an Intel RealSense D400 camera, with stereo shadows and the invalid band at the left edge, the minimum range of the disparity search, disparity noise and quantization that grow asin depth, edge jitter and fattening, and holes on dark, distant, grazing, transparent and mirror surfaces. The right imager sees through the camera's lens, so the invalid band follows a distorted or fisheye lens. Presets realSenseD435()andrealSenseD415()(URDF<depth_model preset="realsense_d435"/>) state the source of each value. The ray cast fills the newgetReturnStrengthArray()(new testtestActiveStereo, benchmarksactive_stereo_noiseandactive_stereo_capture). See Active stereo depth cameras. - Sensor materials:
World::setSensorMaterial()gives a physics material its near-infrared reflectance, retroreflectivity, transmission and specularity, which active stereo cameras and LiDARs use: glass is seen through, mirrors return nothing outside a glint angle, and retroreflectors (tape, road signs) return toward the emitter at any incidence, with the effective reflectance= diffuse part + retroreflectivity, plus the specular glint within the glint angle ( LidarReturns.RetroreflectorsReturnAtAnyIncidence). Kept in world XML (<sensor_material>) and checkpoints;World::rayTestSensor()casts a ray the way these sensors see, andWorld::getBodySensorMaterials()lists the sensor material of every collision body in one pass (SensorMaterials.OnePassListAgreesWithThePerBodyQuery). See Sensor materials. - LiDAR returns from materials:
SpinningLidarProperties::returnModel = REFLECTANCEdetects a surface with a probability set by its reflectance, incidence and range against a data-sheet specification (URDF<return_model>), andgetReflectivity()reports a calibrated reflectivity byte per point in the Velodyne and Ouster convention (new testtestLidarReturns, benchmarklidar_reflectance). See LiDAR returns from materials. - New ground-truth cameras
NormalCamera(surface normals in the world or OpenCV camera frame) andOpticalFlowCamera(backward flow to the previous capture with KITTI-style validity flags), sensor typesnormalandoptical_flow, with a CPU ray-cast source. A pixel iskInFrameonly when the lens images its point at the previous capture, before the fold, on a pixel of the image that has a ray (inside a fisheye's image circle) (GroundTruthCameras.PointsBeyondTheFoldAreNotInFrame).computeBoundingBoxes2D()finds the tight 2D box of every instance of a segmentation image;raisim/sensors/GroundTruthIo.hppwrites and reads Middlebury.flo, KITTI flow PNG, normal PNG and COCO detection JSON with RLE masks, checked byte by byte against the formats (new teststestGroundTruthCameras,testGroundTruthIo, benchmarksground_truth_camerasandbounding_boxes_2d). See Normal camera and Ground-truth files. - The TCP protocol gains
PROTOCOL_FEATURE_CAMERA_MODELS: camera descriptions carry the distortion, shutter and depth model, and an active stereo depth reply its return strengths.RaisimServerdoes not ask the viewer for aMANUALcamera it cannot render: normal and optical-flow cameras, which it leaves out of the frames, rolling-shutter cameras (with a positive readout time; the viewer also refuses them itself), and, for a viewer without the feature, active stereo depth cameras and pinhole lenses with a non-zero distortion. It warns once per camera and client and drops replies for such cameras (new testtestCameraModelProtocol). See Sensor measurements. MeshResource::fromTriangles()makes a mesh from triangles in memory, keeping them as a triangle mesh (MeshCollisionMode::ORIGINAL_MESH) by default. Such a mesh has no file name, and world XML export leaves it out with a warning (new testMeshCollider.MeshFromTrianglesInMemory). See Shared resources across worlds.
rayrai
- Every distorted or fisheye lens renders through one lens remap: an off-axis pinhole source image covering the lens's rays, resampled through a lookup table built from RaiSim's own pixel-to-ray mapping, so rendered and CPU images agree pixel for pixel (new test
rayrai_lens_distortion_test). The source has at least one pixel per image pixel where the lens is densest, fisheye lenses included, up to three times the image size per axis and 4096 pixels (Camera::setMaxLensSourceSize()lowers that limit;SensorBatchRenderercaps it at its tile capacity); a camera configured again with an unchanged lens keeps its table (new testrayrai_lens_remap_plan_test, benchmarkrayrai_lens_remap_benchmark).Camera::configureSensorLens(),outputWidth(),outputHeight()andapplyLensRemap()replacesetFisheyeRemapUniforms()andapplyFisheyeRemap(); the render size of a remapped camera (rtWidth()) can exceed its image size. Behaviour change: for a fisheye or distorted lens the scene colour (getSceneColorTex(),bindSceneFbo()) holds the pinhole source image; the lens image hasoutputWidth()xoutputHeight()pixels.getRawImage()reads the scene colour before post-processing resampled through the lens (getOutputColorTex()), as the readback of a pinhole camera reads its scene colour, andgetFinalTexture()shows the remapped post-processed colour.RayraiWindow::captureSupersampledRgba()keeps the off-axis window of explicit pinhole intrinsics and throwsstd::invalid_argumentfor a remapped camera (new testrayrai_lens_remap_color_test). See Lens models. - Rolling-shutter cameras are rendered in bands by the sensor overloads of
RayraiWindowand bySensorBatchRenderer: in each band the bodies and the camera move with their constant twists to the band's time, a single body turning about its centre of mass and a link about its frame origin (new testrayrai_rolling_shutter_test, which covers every readout direction and the default band count, and new cases inrayrai_physics_snapshot_cpu_test). See Rolling shutter. - Active stereo depth cameras render both imagers and the return strengths, in
RayraiWindowandSensorBatchRenderer(DepthGroup::returnStrength). The right imager's view is projected through the camera's lens, so the invalid band follows distorted and fisheye lenses as on the CPU. The sensor materials come from the frame drawn: physics snapshots carry them (PhysicsSnapshot::sensorMaterials), and a World whose material table exceedsGL_MAX_TEXTURE_SIZEis an error. Face normals are taken before any alpha-mask discard (new testsrayrai_active_stereo_test,rayrai_sensor_shader_derivative_testand new cases inrayrai_physics_snapshot_cpu_test;rayrai_physics_snapshot_benchmarktimes captures with sensor materials). See Active stereo depth. - GPU LiDARs (
RayraiWindow::measureSpinningLidarSingleDrawGPU()andSensorBatchRenderer) follow theREFLECTANCEreturn model: rays continue through transparent bodies met outside the glint angle, andSpinningLidar::applyReturnModel()runs on the surfaces hit, so the kept points, reflectivity bytes and random draws are those of the CPU scan (new testrayrai_lidar_returns_test;rayrai_lidar_benchmarkreports the cost overIDEAL). - Normal and optical-flow images are rendered:
RayraiWindow::renderNormals()andrenderOpticalFlow(), andSensorBatchRenderer::addNormalCamera()/addOpticalFlowCamera()withwriteNormalToSensor()/writeOpticalFlowToSensor(), through every lens and shutter, matching RaiSim's ray casts within 1 degree and 0.25 px (new testrayrai_ground_truth_camera_test, benchmark casesrayrai_sensor_batch_benchmark --sensors=normal,flow). See Normal and optical-flow images. RayraiWindow::computeBoundingBoxes()andSensorBatchRenderer::segmentationBoundingBoxes()add the loose 2D box (the whole instance, occluded parts included, clipped to the image) and the 3D box in the camera frame to the tight boxes of a segmentation image (new testrayrai_bounding_box_test, benchmarkrayrai_segmentation_benchmark). See Bounding boxes.SensorBatchRenderer::setAppearanceRandomization()andrandomizeAppearance(world, episode)randomize the light (direction, intensity, colour temperature from 1667 to 25000 K), ambient, background (mixed in display space) and object colours of each World's RGB cameras, reproducibly per (seed, World, episode) (new testrayrai_sensor_batch_randomization_test, benchmark caserayrai_sensor_batch_benchmark --sensors=rgb_randomized). See Appearance randomization.- Behaviour change:
Camera::getRawImage(sensor)into the sensor,SensorBatchRenderer::write*ToSensor()and the GPU LiDAR commit their captures at the world time of the rendered scene, which setsgetUpdateTimeStamp()and applies the sensor's latency (Camera::getSensorCaptureTime(image), one time per kind of image; new testrayrai_sensor_capture_latency_test). - Gaussian splat scenes:
RayraiWindow::addGaussianSplatScene()andSensorBatchRenderer::addGaussianSplatScene()draw captured 3D Gaussian Splatting scenes (Inria PLY, compressed PLY, SPZ,.splat;readGaussianSplatFile()) with the meshes, in the viewer and in RGB, depth, segmentation and active stereo images (with the scene'ssensorMaterial), on OpenGL 4.3 compute shaders or, on macOS, a transform-feedback path with an exact CPU radix sort; splats receive the sun's mesh shadows (GaussianSplatRenderSettings::shadowStrength, looked up per pixel in the viewer and raster colour images, so a robot's shadow falls on a captured floor); translucent meshes, visuals, water and weather in front of a splat scene show over it, and where its splats are at least half opaque they hide what is translucent behind them; sensor images beyond one GPU storage block are rasterized in bands of rows. The cameras aSensorBatchRendererdraws into one target, and the bands of rolling-shutter cameras, are culled, sorted and rasterized together, each image as it would be alone: 256 depth cameras of 64x64 px see 100k splats in 62 ms and 1M splats in 0.9 s on an RTX 2070 SUPER, where gsplat 1.5.3 takes 105 ms for colour and expected depth and runs out of memory at 1M. SPZ files claiming more thansplats are rejected and a read allocates only for the splats it decodes; a .splatfile is read as SPZ only if its gzip stream holds SPZ data; ASCII PLY numbers are read in the C locale; a logit opacity ofor (PlayCanvas splat-transform writes for fully transparent splats) reads as opacity 0 or 1, and NaN is an error. .rscenefiles take agaussian_splatrecord, and a record whose file or pose the renderer cannot use (an empty file, too many splats for the renderer or the OpenGL context, a position or scale beyond float range) is an error of the scene loading, not a process exit (new testsrayrai_gaussian_splat_*_test, benchmarksrayrai_gaussian_splat_benchmarkandrayrai_gaussian_splat_io_benchmark). See Gaussian splat scenes. - The TCP viewer renders lens distortion and replies with active stereo return strengths (
kProtocolFeatureCameraModels), with the default sensor material on every surface, since the server does not send sensor materials. - Gaussian splat scenes can collide:
addGaussianSplatCollision(world, cloud, pose, raisim::VOXELMAP)andmakeGaussianSplatCollision()(rayrai/GaussianSplatCollision.hpp, and inraisimpy.rayrai) turn a scene's splats into a staticVoxelMapof the voxels its splats together make at leastopacityThresholdopaque (GaussianSplatCollisionOptions: 2 cm voxels, 0.2, splats up to 0.3 m, an optional region), so bodies stand on a captured floor and LiDARs hit it; the map is hidden from rendering. A captured apartment of 661k splats takes about 0.8 s on up to eight threads. A voxel map with the appearance"hidden"no longer builds a render mesh until it is shown (the first frame with 5.6M hidden voxels went from 5.4 s and 5.2 GB to 0.17 s) (new testrayrai_gaussian_splat_collision_test,rayrai_voxel_map_depth_testextended, benchmark casecollision_voxelsinrayrai_gaussian_splat_io_benchmark). - Gaussian splat scenes can also collide as a triangle mesh:
makeGaussianSplatCollisionMesh()makes the boundary of the solid voxels, with their corners cut, araisim::MeshResourceof triangles, merging flat parts into larger triangles within aboutGaussianSplatCollisionOptions::meshTolerance(1 cm), andaddGaussianSplatCollision()with the shaperaisim::MESHadds it as a static, hiddenraisim::Mesh(the shape israisim::VOXELMAPfor the voxels orraisim::MESH; any other type is a fatal error). An 8 m by 8 m region of the captured apartment becomes about 0.9M triangles in about 2 s. rayrai draws a mesh made from triangles in memory in the colour of its appearance and builds nothing for it while it is hidden; the TCP viewer leaves hidden objects, and meshes it has no file for, out of its scene bounds (new cases inrayrai_gaussian_splat_collision_test,rayrai_voxel_map_depth_testandrayrai_tcp_voxel_map_test, benchmark casecollision_meshinrayrai_gaussian_splat_io_benchmark). See Collision mesh. - Coordinate frames and point clouds are drawn before translucent geometry, so translucent meshes, visuals, water and weather in front of them cover them; camera-frustum visuals (
RayraiWindow::addCameraFrustum()) cast no shadow (new testrayrai_gaussian_splat_scene_test). - New examples
rayrai_lens_distortion,rayrai_active_stereo_depth,rayrai_rolling_shutter,rayrai_ground_truth,rayrai_domain_randomization,rayrai_gaussian_splat_sceneandrayrai_gaussian_splat_apartment, which ships a captured splat scan (rsc/gaussian_splats/apartment, CC BY 4.0) placed by a.rscenefile (apartment.rscene) and builds its collision from the scene'sgaussian_splatrecord (see .rscene files).
raisimPy
- Lens models:
CameraPinholeDistortion,CameraLensModel.setOpenCvPinhole()andsetModel(),cameraPixelToRay(),cameraRayToPixel(),distortNormalizedPoint(),undistortNormalizedPoint(),cameraDistortionCoefficients()andCameraLensInverse;CameraShutterand the latency, shutter and active stereo properties of the cameras and LiDARs. SensorMaterialProperties,World.setSensorMaterial(),rayTestSensor(),getSensorMaterialOfBody()andgetBodySensorMaterials();NormalCamera,OpticalFlowCamera,computeBoundingBoxes2D()and the.flo, KITTI flow, normal PNG and COCO readers and writers, with images as numpy arrays.raisimpy.rayraifollows the new rayrai API:Camera.getSensorCaptureTime(),readReturnStrength()andreadNormals(),RayraiWindow.renderNormals(),renderOpticalFlow()andcomputeBoundingBoxes(),SensorBatchRendererwith appearance randomization, and Gaussian splat scenes.MeshResource.fromTriangles(), andraisimpy.rayrai.makeGaussianSplatCollisionMesh()andaddGaussianSplatCollision(..., raisimpy.ObjectType.MESH).
Build and tests
testUsdMeshreads its Isaac Sim USD fixtures from the CMake cache pathRAISIM2LIB_DIR(default../raisim2Libnext to the RaiSim checkout) and names that variable when they are missing.- The new sensor benchmarks join the
sensorsgroup of the benchmark runner and the sensor category of the repository status report. rayrai_webgpu_shader_teststranslates every Gaussian splat compute program to WGSL and checks it against WebGPU's uniformity rules and the default 16384-byte workgroup storage limit.rayrai_sensor_batch_benchmarktimes the batch before it creates the baseline of oneRayraiWindowper World: with 128x128 cameras, 256 windows fill most of an 8 GB GPU, and the evictions that followed slowed the batch's RGB step from 10 ms to 31 ms.