INTRODUCTION Overview Download and Install Quick Start Documentation Publications NONFRAMEWORK CODE Driver Interfaces Drivers Libraries Utilities FRAMEWORK CODE Interfaces Components Libraries Utilities Full Software Listings DEVELOPER Tutorials Examples Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
pathutils.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp 00005 * 00006 * This copy of Orca is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 00011 #ifndef PATH_UTILS_H 00012 #define PATH_UTILS_H 00013 00014 #include <gbxutilacfr/mathdefs.h> 00015 #include <QPointF> 00016 #include <vector> 00017 #include <string> 00018 00019 class QPainter; 00020 class QColor; 00021 00022 namespace hydroqguipath { 00023 00024 const int QT_ANGLE_MULTIPLIER = 16; 00025 00026 // 00027 // Internal Gui representation for waypoint and path 00028 // Author: Tobias Kaupp 00029 // 00030 class GuiWaypoint 00031 { 00032 public: 00033 GuiWaypoint() 00034 : position(QPointF(0.0,0.0)), 00035 heading(0), 00036 timeTarget(0.0), 00037 distanceTolerance(0.0), 00038 headingTolerance(0), 00039 maxSpeed(0.0), 00040 maxTurnrate(0) 00041 {} 00042 00043 QPointF position; // in m 00044 int heading; // in 1/16 deg from 0 to 360*16 00045 float timeTarget; // number of seconds until arrival at waypoint 00046 float distanceTolerance; // distance tolerances in m 00047 int headingTolerance; // heading tolerances in 1/16 deg from 0 to 360*16 00048 float maxSpeed; // max speed in m/s 00049 int maxTurnrate; // max turnrate in deg/s 00050 }; 00051 00052 typedef std::vector<GuiWaypoint> GuiPath; 00053 00054 // 00055 // Tolerances and other parameters of waypoint 00056 // The units are the same as above 00057 // 00058 class WaypointSettings 00059 { 00060 public: 00061 WaypointSettings() {}; 00062 WaypointSettings(std::string a, float b, float c, int d, float e, int f): 00063 spacingProperty(a), 00064 spacingValue(b), 00065 distanceTolerance(c), 00066 headingTolerance(d), 00067 maxApproachSpeed(e), 00068 maxApproachTurnrate(f) 00069 {} 00070 std::string spacingProperty; 00071 float spacingValue; 00072 float distanceTolerance; 00073 int headingTolerance; 00074 float maxApproachSpeed; 00075 int maxApproachTurnrate; 00076 }; 00077 00078 // Compute straight line distance of two points in [m] 00079 float straightLineDist( QPointF line ); 00080 00081 // Draws one of guiPath's waypoints given a painter 00082 void drawWaypoint( QPainter *painter, 00083 const GuiPath &guiPath, 00084 int index, 00085 const QColor &fillColor, 00086 const QColor &drawColor ); 00087 00088 // Draws connections between waypoints of guiPath given a painter 00089 // Starts at wp with startIndex and finishes at wp with endIndex 00090 void drawWpConnections( QPainter *painter, 00091 const GuiPath &guiPath, 00092 const QColor &color, 00093 int startIndex, 00094 int endIndex ); 00095 00096 } 00097 00098 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)