Commit 6fcf5e5d authored by oscar's avatar oscar

提交更新

parent c40ded97
......@@ -3,9 +3,10 @@
#include <string>
#include <vector>
#include <map>
namespace jf {
enum class LaneType {
enum class LaneType {
NotInvestigated = 0, // 未调查
NormalLane = 1, // 普通车道
EnterLane = 2, // 入口车道
......@@ -29,26 +30,23 @@ enum class LaneType {
NonMotorizedLane = 30, // 非机动车道
Sidewalk = 40, // 人行道
Ohters = 99, // 其它车道
};
};
enum class EdgeCrossType {
enum class EdgeCrossType {
NotInvestigated = 0, // 未调查
Unable = 1, // 无法跨越
BidirecAble = 2, // 双方向跨越
LeftAble = 3, // 向左跨越
RightAble = 4, // 向右跨越
};
};
/**
/**
* @brief 84坐标系中的点
*
*/
struct Point {
struct Point {
Point() : dLon(0), dLat(0), dAlt(0) {};
Point(double inlon, double inlat, double alt);
Point(const Point& o);
Point(const std::vector<double>& d);
Point(const std::map<std::string, double>& m);
Point(double inlon, double inlat, double alt) : dLon(inlon), dLat(inlat), dAlt(alt) {}
/**
* @brief 经度
......@@ -65,25 +63,20 @@ struct Point {
*
*/
double dAlt;
};
Point& operator=(const Point& o);
bool operator==(const Point& o) const { return dLon == o.dLon && dLat == o.dLat && dAlt == o.dAlt; }
bool operator!=(const Point& o) const { return !(*this == o); }
std::string to_string() const { return std::to_string(dLon) + ", " + std::to_string(dLat) + ", " + std::to_string(dAlt); }
};
class MapInterface {
class MapInterface {
public:
MapInterface(const std::string &strPrjPath, const std::string strCfgPath);
MapInterface(const std::string& strPrjPath, const std::string strCfgPath);
~MapInterface();
public:
bool GetMapData(const Point &ptInLoc, double dCarAngle, int &nOutLaneCnt, int &nOutLaneNum, LaneType &nOutLaneType, EdgeCrossType &nOutLeftEdgeCrossType, EdgeCrossType &nOutRightEdgeCrossType, int &nOutSpeedLimit, double &dOutLaneAngle,
Point &ptOutFoot);
bool GetMapData(const Point &ptInLoc, double dCarAngle, long &lOutRaodId, std::vector<long> &vctlOutPreRoadId, std::vector<long> &vctlOutNxtRoadId, int &nLaneCnt, int &nOutLaneNum, LaneType &nOutLaneType, EdgeCrossType &nOutLeftEdgeCrossType,
EdgeCrossType &nOutRightEdgeCrossType, int &nOutSpeedLimit, double &dOutLaneAngle, Point &ptOutFoot);
bool GetMapData(const Point& ptInLoc, double dCarAngle, int& nOutLaneCnt, int& nOutLaneNum, LaneType& nOutLaneType, EdgeCrossType& nOutLeftEdgeCrossType, EdgeCrossType& nOutRightEdgeCrossType, int& nOutSpeedLimit, double& dOutLaneAngle,
Point& ptOutFoot);
bool GetMapData(const Point& ptInLoc, double dCarAngle, long& lOutRaodId, std::vector<long>& vctlOutPreRoadId, std::vector<long>& vctlOutNxtRoadId, int& nLaneCnt, int& nOutLaneNum, LaneType& nOutLaneType, EdgeCrossType& nOutLeftEdgeCrossType,
EdgeCrossType& nOutRightEdgeCrossType, int& nOutSpeedLimit, double& dOutLaneAngle, Point& ptOutFoot);
};
};
} // namespace jf
#endif
\ No newline at end of file
......@@ -4,7 +4,6 @@
#include <vector>
#include "MapInterface.hpp"
using namespace OpenDrive;
int main(int argc, char* argv[])
{
......@@ -12,7 +11,7 @@ int main(int argc, char* argv[])
std::string dir = "";
std::string cfg = "";
jf::MapInterface mapInstance(dir,cfg);
jf::MapInterface mapInstance(dir, cfg);
int nLaneCnt = 0/*所在道路的车道总数*/, nOutLaneNum = 0;//当前所在位置的车道序号,从左至右,从1开始
jf::LaneType nOutLaneType = jf::LaneType::NotInvestigated;//车道类型,看头文件枚举
......@@ -21,15 +20,15 @@ int main(int argc, char* argv[])
int nOutSpeedLimit = 0;//车道最高限速值,单位是千米每小时
double dOutLaneAngle = 0.0;//所在车道,车应该的朝向角度,北为0,顺时针旋转360,0-360
const jf::Point ptInLoc = { objAll.obj.lon, objAll.obj.lat, 0.0 };
const jf::Point ptInLoc = { 106.474419689, 29.67213045, 0.0 };
jf::Point ptOutFoot;//车道中心线做垂线的点
double dCarAngle = objAll.obj.heading;
double dCarAngle = 0;
long lOutRaodId;
std::vector<long> vctlOutPreRoadId;
std::vector<long> vctlOutNxtRoadId;
//ROS_INFO("begin call jfxmap");
bool result = m_OfflineMap->GetMapData(ptInLoc, dCarAngle, lOutRaodId, vctlOutPreRoadId, vctlOutNxtRoadId,
bool result = mapInstance.GetMapData(ptInLoc, dCarAngle, lOutRaodId, vctlOutPreRoadId, vctlOutNxtRoadId,
nLaneCnt, nOutLaneNum, nOutLaneType,
nOutLeftEdgeCrossType, nOutRightEdgeCrossType,
nOutSpeedLimit, dOutLaneAngle, ptOutFoot);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment