Issue with creating Pose[] pose array
Since, i have created my own service whose requests are seven geometry_msgs/Pose point1, point2 ...point7. I am calling all of these request into my script in the following way;
std::vector<geometry_msgs::Pose> waypoints;
int number_of_waypoints = 7;
double x[number_of_waypoints];
x[0] = request.point1.position.x;
x[1] = request.point2.position.x;
x[2] = request.point3.position.x;
x[3] = request.point4.position.x;
x[4] = request.point5.position.x;
x[5] = request.point6.position.x;
x[6] = request.point7.position.x;
double y[number_of_waypoints];
y[0] = request.point1.position.y;
y[1] = request.point2.position.y;
y[2] = request.point3.position.y;
y[3] = request.point4.position.y;
y[4] = request.point5.position.y;
y[5] = request.point6.position.y;
y[6] = request.point7.position.y;
double z[number_of_waypoints];
z[0] = request.point1.position.z;
z[1] = request.point2.position.z;
z[2] = request.point3.position.z;
z[3] = request.point4.position.z;
z[4] = request.point5.position.z;
z[5] = request.point6.position.z;
z[6] = request.point7.position.z;
Now i want to create an array instead of calling all of these separately on the run time. Because when i call my service from the terminal, it asks me to put all the seven poses, that is perfect but i want to it win such a way that from the terminal it asks the number of way-points and then it asks me to substitute the given number of poses for way-points. Right now, the seven way-points are hard coded, means if want to increase or decrease the number, i have to do it manually. I want to use geometry_msgs/Pose[] pose in my service instead of declaring the seven messages separately and then creating an array inside my script to ask me the number of way-points and then forms the size of array according and ask me the poses in the terminal. I am bit confused how to do it.
Looking forward to the help.
Thank You