How does one assign values to messages with arrays in C++
This is probably more C++ focused, but here is my issue:
int8_t vi[height * width];
// vi has had work done on it between here
nav_msgs::OccupancyGrid debMap;
debMap.data = vi; // error here
The resulting error is:
no operator "=" matches these operands -- operand types are: std::vector<int8_t, std::allocator<int8_t>> = int8_t [height * width]
Now in python something like this would be an issue. In the past I have been using memcpy to get around this, but I am less certain that that is the approach to take for this.
How can I add array data to a message with an array.
I believe, one brute force method is,
I'm dunno if there is a way to directly assign it to data. May be treated debMap.data as
std::vector
and use one of the suggested methods here.