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

Assuming your other data types match, data is a vector, so you can't simply set it using =. Which explains your 'overloaded =' error. Why your memcpy didn't work is difficult to say without actual code; it should look something like:

memcpy(leftImage.data.data(),
       pFrameData->leftData,
       sizeof(uint8_t)*pFrameData->height*pFrameData->width)

I may have overlooked some details, this being off the top of my head (e.g., I think you need to cast the 1st and 2nd parameters to void*).

Assuming your other data types match, data is a vector, so you can't simply set it using =. Which explains your 'overloaded =' error. Why your memcpy didn't work is difficult to say without actual code; it should look something like:

memcpy(leftImage.data.data(),
       pFrameData->leftData,
       sizeof(uint8_t)*pFrameData->height*pFrameData->width)

I may have overlooked some details, this being off the top of my head (e.g., I think you need to cast the 1st and 2nd parameters to void*).

And, after seeing @ahendrix's answer, I realize I forgot to reserve space before the memcpy. D'oh!