Visualisation changes camera resolution
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Robot3D |
New
|
Medium
|
Unassigned |
Bug Description
In every sensor derived from CameraSensorBase the resolution is adjusted such that what it sees can be visualised in the right corner in the Robot3D window.
dtCore::Camera *mCamera = dynamic_
mCamera-
int screenWidth, screenHeight, winX, winY;
GA->GetWindow(
float margin = 0.3;
float width = (float) (0.25 * screenWidth - margin * 2);
float height = width; //we want it square
float xPos = (float) (0.75 * screenWidth + margin);
float yPos = (float) (screenHeight - height - margin);
mCamera-
The problem is that the viewport will be set to the dimensions of the Robot3D window and not to the actual resolution parameters. When retrieving the images directly over YARP this is painfully obvious. When the user for example resizes the screen the camera even gets a different aspect ratio and the images send to the controller will get this different aspect ratio.
There are three things needed:
(1) Only render one sensor at a time to the screen
(2) Use a pbuffer for each sensor that preserves the proper resolution (and don't render it to the screen)
(3) The rendering should be able to coarse grain e.g. a 32x32 image such that it fills up e.g. a 256x256 pixel space on a computer screen
Test case:
Use in ~/.robot3d/
<Robot name="robot_0" type="RobotKIT" x="-25" y="-30" z="1.2" h="-90" p="0" r="0" connected="0"/>
<Controller name="cont0" type="YarpedRobot" robotToControl=
And in the console:
coproc yarpview /view; sleep 1; yarp connect /robot3d/
Go in the yarp viewer to Image - Original aspect ratio, and you will see that effect in effect.
The only workaround now is not to display it on the screen. Even calling mCamera-