2 #include <find_moving_objects/MovingObjectArray.h> 3 #include <find_moving_objects/MovingObject.h> 9 void callback(
const find_moving_objects::MovingObjectArray::ConstPtr & msg)
11 cout <<
"Received message from node " << msg->origin_node_name
12 <<
" containing " << msg->objects.size() <<
" detected moving objects." << endl;
14 for (
int i=0; i<msg->objects.size(); ++i)
16 cout <<
" Object " << i <<
" has center point at (" 17 << msg->objects[i].position.x <<
"," 18 << msg->objects[i].position.y <<
"," 19 << msg->objects[i].position.z <<
") relative the sensor (i.e. in frame " 20 << msg->objects[i].header.frame_id <<
")" 21 << endl <<
" and at (" 22 << msg->objects[i].position_in_map_frame.x <<
"," 23 << msg->objects[i].position_in_map_frame.y <<
"," 24 << msg->objects[i].position_in_map_frame.z <<
") in the map (i.e. in frame " 25 << msg->objects[i].map_frame <<
")" << endl
26 <<
" and is travelling with relative speed " 27 << msg->objects[i].speed <<
"m/s" << endl
28 <<
" and absolute speed " 29 << msg->objects[i].speed_in_map_frame <<
"m/s." << endl;
37 int main (
int argc,
char ** argv)
50 nh_priv.
param(
"topic", topic,
string(
"moving_objects"));
51 nh_priv.
param(
"buffer_size", buffer_size, 10);
int main(int argc, char **argv)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ROSCPP_DECL void spin(Spinner &spinner)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
void callback(const find_moving_objects::MovingObjectArray::ConstPtr &msg)
static bool waitForValid()