Streaming video camera

Typically: "How do I... ", "How can I... " questions
coppelia
Site Admin
Posts: 7272
Joined: 14 Dec 2012, 00:25

Re: Streaming video camera

Post by coppelia » 04 Feb 2018, 16:13

Yes, you will be able to use BlueZero in other applications too, since it is a c/c++ library.

Also, releasing the buffer returned by V-REP (e.g. in simGetVisionSensorCharImage) is very important, otherwise you will run into memory issues.

Cheers

lpitonakova
Posts: 17
Joined: 22 Nov 2017, 12:32

Re: Streaming video camera

Post by lpitonakova » 05 Feb 2018, 12:07

Ok - I made the char* array (I assume that's what you mean by buffer) a class variable. So, are you saying that it's better to just create and delete a new buffer in every loop? Wouldn't that be slower?

lpitonakova
Posts: 17
Joined: 22 Nov 2017, 12:32

Re: Streaming video camera

Post by lpitonakova » 05 Feb 2018, 13:03

Also, I have another question about releasing. The description of simxGetVisionSensorImage (http://www.coppeliarobotics.com/helpFil ... ensorImage)says that the data is automatically released.

When I try this:

Code: Select all

    simUChar* image = new simUChar{};
    if (simxGetConnectionId(simulatorInterface->GetServerId()) != -1) {
        if (simxGetVisionSensorImage(simulatorInterface->GetServerId(),remoteVisionSensor,remoteVisionSensorResolution,&image,0,simx_opmode_buffer) == 0) {
            //-- todo: do something with the image
            simxReleaseBuffer(image);
        }
     }
The program crashes with " malloc: *** error for object 0x1211fe026: pointer being freed was not allocated"
Am I doing this correctly?

lpitonakova
Posts: 17
Joined: 22 Nov 2017, 12:32

Re: Streaming video camera

Post by lpitonakova » 05 Feb 2018, 15:26

Hi again, after some digging, I don't think that the buffer is the problem. I went back to start and looked at your example scene headlessModeDebug.

Since in that scene, the rendering is over pretty quickly, as the robot falls off, I loaded a different scene through the script. That all works fine until I remove

Code: Select all

simLaunchExecutable(appPath..'/vrep','-h -gREMOTEAPISERVERSERVICE_19900_FALSE_TRUE',1)
From the "visualisation" script and instead run a v-rep instance from the command line manually, using the same command line arguments as above. When I do that, the freezing occurs again.

Is this basically some kind of a bug in V-REP? I cannot see any solution to this for a program that is supposed to connect to an already running V-REP instance.

coppelia
Site Admin
Posts: 7272
Joined: 14 Dec 2012, 00:25

Re: Streaming video camera

Post by coppelia » 07 Feb 2018, 18:07

Sorry, I forgot you are using the remote API. In that case the buffer does not need to be created nor released.

Sorry, I can't figure out nor reproduce what you have..

Cheers

Post Reply