Skip to Content
ROS Programming: Building Powerful Robots
book

ROS Programming: Building Powerful Robots

by Anil Mahtani, Luis Sanchez, Enrique Fernandez, Aaron Martinez, Lentin Joseph
March 2018
Intermediate to advanced content levelIntermediate to advanced
1396 pages
42h 14m
English
Packt Publishing
Content preview from ROS Programming: Building Powerful Robots

Creating an example project to use GPS

In this example, we are going to project the latitude and the longitude of GPS to a 2D Cartesian space. For this, we will use a function written by Chuck Gantz that converts latitudes and longitudes into UTM coordinates. The node will subscribe to the /fix topic where GPS data is sent. You can find the code in chapter8_tutorials in the c8_fixtoUTM.cpp file:

#include <ros/ros.h> #include <tf/transform_broadcaster.h> #include <nav_msgs/Odometry.h> #include <stdio.h> #include <iostream> #include <sensor_msgs/NavSatFix.h> geometry_msgs::Point global_position; ros::Publisher position_pub; void gpsCallBack(const sensor_msgs::NavSatFixConstPtr& gps) { double northing, easting; char zone; LLtoUTM(gps->latitude, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming Robots with ROS

Programming Robots with ROS

Morgan Quigley, Brian Gerkey, William D. Smart
Machine Learning Design Patterns

Machine Learning Design Patterns

Valliappa Lakshmanan, Sara Robinson, Michael Munn

Publisher Resources

ISBN: 9781788627436Supplemental Content