Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef CADDYKML_HPP_
00038 #define CADDYKML_HPP_
00039
00040 #include <fstream>
00041 #include <deque>
00042 #include <labust/gearth/GoogleEarthLib.hpp>
00043 #include <labust/gearth/CustomLineString.hpp>
00044 #include <labust/gearth/VehiclePolygon.hpp>
00045
00046 #include <ros/ros.h>
00047 #include <auv_msgs/NavSts.h>
00048
00049 #include <boost/thread/mutex.hpp>
00050 #include <boost/thread.hpp>
00051
00052 namespace labust
00053 {
00054 namespace gearth
00055 {
00069 class CaddyKML
00070 {
00071 public:
00075 CaddyKML();
00079 ~CaddyKML();
00080
00086 void addVehiclePosition(const auv_msgs::NavSts::ConstPtr& nav)
00087 {
00088 kmlbase::Vec3 position(nav->global_position.longitude,
00089 nav->global_position.latitude,
00090 -nav->position.depth);
00091
00092 boost::mutex::scoped_lock l(kml_mux);
00093 path.addPoint(position);
00094 vehicle.updatePosition(position,nav->orientation.yaw);
00095 diver= *nav;
00096
00097 }
00103 void addShipPosition(const auv_msgs::NavSts::ConstPtr& nav)
00104 {
00105 kmlbase::Vec3 position(nav->global_position.longitude,
00106 nav->global_position.latitude,
00107 -nav->position.depth);
00108 boost::mutex::scoped_lock l(kml_mux);
00109 ship.updatePosition(position,nav->orientation.yaw);
00110 platformPath.addPoint(position);
00111 platform = *nav;
00112
00113 }
00117 void setDiverOrigin(const geometry_msgs::Point::ConstPtr& point);
00121 void write();
00125 void run();
00126
00127 private:
00131 void addOpRegionToDocument(kmldom::DocumentPtr document);
00135 void addVarianceRegion(const auv_msgs::NavSts& nav, kmldom::DocumentPtr document);
00139 CustomLineString<TransparentSegments> path, platformPath;
00143 VehiclePolygon vehicle;
00147 VehiclePolygon ship;
00151 kmldom::CoordinatesPtr opRegion;
00155 kmlbase::Vec3 diverOrigin;
00159 kmldom::KmlFactory* factory;
00163 kmldom::DocumentPtr folder;
00167 std::string filename;
00171 std::ofstream kmlFile;
00175 boost::mutex kml_mux;
00179 auv_msgs::NavSts diver, platform;
00183 boost::thread worker;
00187 bool runFlag;
00188 };
00189 }
00190 }
00191
00192 #endif