ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

After I've tried everything I could do, I decided to reset my PC and after I installed all the things, it seems the problem is gone. I guess something was corrupted with Windows.

After I've tried everything I could do, I decided to reset my PC and after I installed all the things, it seems the problem is gone. I guess something was corrupted with Windows.

---> EDIT: <---

Sadly this is only a temporary solution. Right now I still have the same problem, but maybe this time I found the cause. I'm writing a node that receive some image from Coppelia, and send it over with a topic. This morning and yesterday I was trying to fix it, because I wasn't able to see the image, but after some "runs" the nodes stopped working. And I still have the same problem as before (third node pending even with the tutorial code).

For the image I set some buffers:

simxUChar *eyeBuffers[2];
dim = resolution[0] * resolution[1] * sizeof(simxUChar);
eyeBuffers[0] = new simxUChar[dim];
eyeBuffers[1] = new simxUChar[dim];

and then set the sensor_msgs.Image msg:

int resolution[2] = { 320, 240 };    
for (int i = 0; i < 2; i++) {
                simxGetVisionSensorImage(clientID, eyes[i], resolution, &eyeBuffers[i], 0, simx_opmode_buffer);
                std::vector<uint8_t> vec((uint8_t)eyeBuffers[i], (uint8_t)eyeBuffers[i] + dim);
                images.images[i].width = resolution[0];
                images.images[i].height = resolution[1];
                images.images[i].encoding = "";
                images.images[i].is_bigendian = false;
                images.images[i].step = resolution[0]* resolution[1];
                images.images[i].data = vec;
}

I know for sure that something is wrong in this code, since I couldn't see the correct image, but a black image with some white interferences.

What I can't understand is why this leads to ROS2 malfunction. I have the impression that something is going to saturate inside ros, because the problem because only came out after a few runs (around 20), and before it was all fine and I could run as many nodes as I wanted.

Is it something related to the memory allocation? Is there a way to fix it without reinstalling windows?

After I've tried everything I could do, I decided to reset my PC and after I installed all the things, it seems the problem is gone. I guess something was corrupted with Windows.

---> EDIT: still not working<---

Sadly this is only a temporary solution. Right now I still have the same problem, but maybe this time I found the cause. I'm writing a node that receive some image from Coppelia, and send it over with a topic. This morning and yesterday I was trying to fix it, because I wasn't able to see the image, but after some "runs" the nodes stopped working. And I still have the same problem as before (third node pending even with the tutorial code).

For the image I set some buffers:

simxUChar *eyeBuffers[2];
dim = resolution[0] * resolution[1] * sizeof(simxUChar);
eyeBuffers[0] = new simxUChar[dim];
eyeBuffers[1] = new simxUChar[dim];

and then set the sensor_msgs.Image msg:

int resolution[2] = { 320, 240 };    
for (int i = 0; i < 2; i++) {
                simxGetVisionSensorImage(clientID, eyes[i], resolution, &eyeBuffers[i], 0, simx_opmode_buffer);
                std::vector<uint8_t> vec((uint8_t)eyeBuffers[i], (uint8_t)eyeBuffers[i] + dim);
                images.images[i].width = resolution[0];
                images.images[i].height = resolution[1];
                images.images[i].encoding = "";
                images.images[i].is_bigendian = false;
                images.images[i].step = resolution[0]* resolution[1];
                images.images[i].data = vec;
arr[i] = cv::Mat(resolution[1], resolution[0], CV_8UC3, eyeBuffers[i]);
                flip(arr[i], arr_flip[i], 1);
}
.. and then cv::Bridge to fill the msg.

I know for sure that don't have any build errors and I can correctly send and receive the images.

After a few days, I've done some more test and now I can run only 1 node, all the others keep hanging. I thought it was something is wrong in this code, since I couldn't see the correct image, related to dynamic memory allocation, but a black image with some white interferences. I delete[] them.

What I can't understand is why this leads to ROS2 malfunction. I have the impression that something is going to saturate inside ros, ros, because the problem because only came out after a few runs (around 20), and before it was all fine and I could run as many nodes as I wanted.

Is it something related to the memory allocation? Is there a way to fix it without reinstalling windows?

Any ideas?

After I've tried everything I could do, I decided to reset my PC and after I installed all the things, it seems the problem is gone. I guess something was corrupted with Windows.

---> EDIT: still not working<---

Sadly this is only a temporary solution. Right now I still have the same problem, but maybe this time I found the cause. I'm writing a node that receive some image from Coppelia, and send it over with a topic. This morning and yesterday I was trying to fix it, because I wasn't able to see the image, but after some "runs" the nodes stopped working. And I still have the same problem as before (third node pending even with the tutorial code).

For the image I set some buffers:

simxUChar *eyeBuffers[2];
dim = resolution[0] * resolution[1] * sizeof(simxUChar);
eyeBuffers[0] = new simxUChar[dim];
eyeBuffers[1] = new simxUChar[dim];

and then set the sensor_msgs.Image msg:

int resolution[2] = { 320, 240 };    
for (int i = 0; i < 2; i++) {
                simxGetVisionSensorImage(clientID, eyes[i], resolution, &eyeBuffers[i], 0, simx_opmode_buffer);
                arr[i] = cv::Mat(resolution[1], resolution[0], CV_8UC3, eyeBuffers[i]);
                flip(arr[i], arr_flip[i], 1);
}
.. and then cv::Bridge to fill the msg.

I don't have any build errors and I can correctly send and receive the images.

After a few days, I've done some more test and now I can run only 1 node, all the others keep hanging. I thought it was something related to dynamic memory allocation, but I delete[] them.

What I can't understand is why this leads to ROS2 malfunction. I have the impression that something is going to saturate inside ros, because the problem only came out after a few runs (around 20), and before it was all fine and I could run as many nodes as I wanted.

Any ideas?

---> EDIT2: possible solution<---

I've found that changing the RMW implementation does the work. I was using the default one (rmw_fastrtps_cpp), and I changed it to rmw_cyclonedds_cpp. Now, without reinstalling anything, ROS seems to work normally.

After I've tried everything I could do, I decided to reset my PC and after I installed all the things, it seems the problem is gone. I guess something was corrupted with Windows.

---> LAST EDIT: still not working<---

Sadly this is only a temporary solution. Right now I still have the same problem, but maybe this time I found the cause. I'm writing a node that receive some image from Coppelia, and send it over with a topic. This morning and yesterday I was trying to fix it, because I wasn't able to see the image, but after some "runs" the nodes stopped working. And I still have the same problem as before (third node pending even with the tutorial code).

For the image I set some buffers:

simxUChar *eyeBuffers[2];
dim = resolution[0] * resolution[1] * sizeof(simxUChar);
eyeBuffers[0] = new simxUChar[dim];
eyeBuffers[1] = new simxUChar[dim];

and then set the sensor_msgs.Image msg:

int resolution[2] = { 320, 240 };    
for (int i = 0; i < 2; i++) {
                simxGetVisionSensorImage(clientID, eyes[i], resolution, &eyeBuffers[i], 0, simx_opmode_buffer);
                arr[i] = cv::Mat(resolution[1], resolution[0], CV_8UC3, eyeBuffers[i]);
                flip(arr[i], arr_flip[i], 1);
}
.. and then cv::Bridge to fill the msg.

I don't have any build errors and I can correctly send and receive the images.

After a few days, I've done some more test and now I can run only 1 node, all the others keep hanging. I thought it was something related to dynamic memory allocation, but I delete[] them.

What I can't understand is why this leads to ROS2 malfunction. I have the impression that something is going to saturate inside ros, because the problem only came out after a few runs (around 20), and before it was all fine and I could run as many nodes as I wanted.

---> EDIT2: possible solution<---

I've found that changing the RMW implementation does the work. I was using the default one (rmw_fastrtps_cpp), and I changed it to rmw_cyclonedds_cpp. Now, without reinstalling anything, ROS seems to work normally.

Temporary solution:

I decided to reset my PC and after I installed all the things, it seems the problem is gone. I guess something gets corrupted between fastrtps and Windows. Anyways, using the same code with rmw_fastrtps_cpp will lead you to the same situation as before.