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

Revision history [back]

Hello!! I was trying to implement my task that is similar to yours and I got the output of x coordinate..

int sum;
for (uint32_t i=0; i<2; ++i)
{
geometry_msgs::Point p;

p.x = i;
p.y = 0.5;
p.z = 0.5;

line.points.push_back(p);
point.points.push_back(p);
p.z += 1.0;
point.points.push_back(p);
//std::cout<<"The coordinates: "<<p<<std::endl;
sum = p.x + p.y + p.z;
std::cout<<"The coordinates: "<<sum<<std::endl;
}

The output is:

The coordinates: 2
The coordinates: 3
The coordinates: 2
The coordinates: 3