How to get length of array of geometry_msg:Points in service handle?
I'm trying to find the length of an array of geometry_msg:Point passed to a service handle, so I can iterate over each Point, apply a transform and then push onto a response. when I use sizeof(req.points) - I get "24" regardless of the number of points actually in the message.
TransformPoints.srv
geometry_msgs/Point[] points
---
geometry_msgs/Point[] points
The callback:
static bool pointsCallback(image_transform::TransformPoints::Request &req,
image_transform::TransformPoints::Response &res) {
int no_points = sizeof(req.points);
int point_size = sizeof(geometry_msgs::Point);
std::cout << no_points << std::endl;
std::cout << point_size << std::endl;
std::cout << req.points[0] << std::endl;
std::cout << req.points[1] << std::endl;
Will output something like this:
24 # sizeof(req.points)
24 # sizeof(geometry_msgs::Point);
x: 0
y: 1
z: 0
x: 1
y: 2
z: 0