7 int main(
int argc,
char** argv)
10 init(argc, argv,
"move_demo");
18 ROS_INFO(
"Created map with size %f x %f m (%i x %i cells).\n The center of the map is located at (%f, %f) in the %s frame.",
19 map.getLength().x(), map.getLength().y(),
20 map.getSize()(0), map.getSize()(1),
21 map.getPosition().x(), map.getPosition().y(), map.getFrameId().c_str());
22 map[
"layer"].setRandom();
24 bool useMoveMethod =
true;
28 ROS_INFO(
"Using the `move(...)` method.");
30 ROS_INFO(
"Using the `setPosition(...)` method.");
41 duration = time - startTime;
44 const double t = duration.
toSec();
48 tempMap.
move(newPosition);
55 grid_map_msgs::GridMap message;
58 ROS_DEBUG(
"Grid map (duration %f) published with new position [%f, %f].",
63 useMoveMethod = !useMoveMethod;
int main(int argc, char **argv)
void setPosition(const Position &position)
void publish(const boost::shared_ptr< M > &message) const
bool getPosition(const Index &index, Position &position) const
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
static void toMessage(const grid_map::GridMap &gridMap, grid_map_msgs::GridMap &message)
bool move(const Position &position, std::vector< BufferRegion > &newRegions)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
void setFrameId(const std::string &frameId)
void setTimestamp(const Time timestamp)