Commit 6fcf5e5d authored by oscar's avatar oscar

提交更新

parent c40ded97
...@@ -3,87 +3,80 @@ ...@@ -3,87 +3,80 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <map>
namespace jf { namespace jf {
enum class LaneType { enum class LaneType {
NotInvestigated = 0, // 未调查 NotInvestigated = 0, // 未调查
NormalLane = 1, // 普通车道 NormalLane = 1, // 普通车道
EnterLane = 2, // 入口车道 EnterLane = 2, // 入口车道
ExitLane = 3, // 出口车道 ExitLane = 3, // 出口车道
ConnectLane = 4, // 连接车道 ConnectLane = 4, // 连接车道
EmergencyLane = 5, // 应急车道 EmergencyLane = 5, // 应急车道
StopLane = 6, // 停车道 StopLane = 6, // 停车道
EmergencyStopLane = 7, // 紧急停车道 EmergencyStopLane = 7, // 紧急停车道
AcceleratingLane = 8, // 加速车道 AcceleratingLane = 8, // 加速车道
DeceleratingLane = 9, // 减速车道 DeceleratingLane = 9, // 减速车道
HazardLane = 10, // 避险车道 HazardLane = 10, // 避险车道
JunctionLane = 11, // 路口车道 JunctionLane = 11, // 路口车道
TollStationLane = 12, // 收费站车道 TollStationLane = 12, // 收费站车道
CheckpointLane = 13, // 检查站车道 CheckpointLane = 13, // 检查站车道
UTurnLane = 14, // 掉头车道 UTurnLane = 14, // 掉头车道
BusLane = 15, // 公交车道 BusLane = 15, // 公交车道
TidalLane = 16, // 潮汐(可变) 车道 TidalLane = 16, // 潮汐(可变) 车道
LocomotiveLane = 17, // 机车车道 LocomotiveLane = 17, // 机车车道
LocomotiveParkingArea = 18, // 机车停车区 LocomotiveParkingArea = 18, // 机车停车区
HOVHighLoadLane = 19, // HOV 高承载车道 HOVHighLoadLane = 19, // HOV 高承载车道
NonMotorizedLane = 30, // 非机动车道 NonMotorizedLane = 30, // 非机动车道
Sidewalk = 40, // 人行道 Sidewalk = 40, // 人行道
Ohters = 99, // 其它车道 Ohters = 99, // 其它车道
}; };
enum class EdgeCrossType { enum class EdgeCrossType {
NotInvestigated = 0, // 未调查 NotInvestigated = 0, // 未调查
Unable = 1, // 无法跨越 Unable = 1, // 无法跨越
BidirecAble = 2, // 双方向跨越 BidirecAble = 2, // 双方向跨越
LeftAble = 3, // 向左跨越 LeftAble = 3, // 向左跨越
RightAble = 4, // 向右跨越 RightAble = 4, // 向右跨越
}; };
/**
* @brief 84坐标系中的点
*
*/
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);
/**
* @brief 经度
*
*/
double dLon;
/**
* @brief 维度
*
*/
double dLat;
/** /**
* @brief 高度 * @brief 84坐标系中的点
* *
*/ */
double dAlt; struct Point {
Point() : dLon(0), dLat(0), dAlt(0) {};
Point(double inlon, double inlat, double alt) : dLon(inlon), dLat(inlat), dAlt(alt) {}
Point& operator=(const Point& o); /**
bool operator==(const Point& o) const { return dLon == o.dLon && dLat == o.dLat && dAlt == o.dAlt; } * @brief 经度
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); } */
}; double dLon;
/**
* @brief 维度
*
*/
double dLat;
/**
* @brief 高度
*
*/
double dAlt;
};
class MapInterface { class MapInterface {
public: public:
MapInterface(const std::string &strPrjPath, const std::string strCfgPath); MapInterface(const std::string& strPrjPath, const std::string strCfgPath);
~MapInterface(); ~MapInterface();
public: public:
bool GetMapData(const Point &ptInLoc, double dCarAngle, int &nOutLaneCnt, int &nOutLaneNum, LaneType &nOutLaneType, EdgeCrossType &nOutLeftEdgeCrossType, EdgeCrossType &nOutRightEdgeCrossType, int &nOutSpeedLimit, double &dOutLaneAngle, bool GetMapData(const Point& ptInLoc, double dCarAngle, int& nOutLaneCnt, int& nOutLaneNum, LaneType& nOutLaneType, EdgeCrossType& nOutLeftEdgeCrossType, EdgeCrossType& nOutRightEdgeCrossType, int& nOutSpeedLimit, double& dOutLaneAngle,
Point &ptOutFoot); 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, 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); EdgeCrossType& nOutRightEdgeCrossType, int& nOutSpeedLimit, double& dOutLaneAngle, Point& ptOutFoot);
}; };
} // namespace jf } // namespace jf
#endif #endif
\ No newline at end of file
...@@ -4,15 +4,14 @@ ...@@ -4,15 +4,14 @@
#include <vector> #include <vector>
#include "MapInterface.hpp" #include "MapInterface.hpp"
using namespace OpenDrive;
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
printf("hello world\n"); printf("hello world\n");
std::string dir = ""; std::string dir = "";
std::string cfg = ""; std::string cfg = "";
jf::MapInterface mapInstance(dir,cfg); jf::MapInterface mapInstance(dir, cfg);
int nLaneCnt = 0/*所在道路的车道总数*/, nOutLaneNum = 0;//当前所在位置的车道序号,从左至右,从1开始 int nLaneCnt = 0/*所在道路的车道总数*/, nOutLaneNum = 0;//当前所在位置的车道序号,从左至右,从1开始
jf::LaneType nOutLaneType = jf::LaneType::NotInvestigated;//车道类型,看头文件枚举 jf::LaneType nOutLaneType = jf::LaneType::NotInvestigated;//车道类型,看头文件枚举
...@@ -21,15 +20,15 @@ int main(int argc, char* argv[]) ...@@ -21,15 +20,15 @@ int main(int argc, char* argv[])
int nOutSpeedLimit = 0;//车道最高限速值,单位是千米每小时 int nOutSpeedLimit = 0;//车道最高限速值,单位是千米每小时
double dOutLaneAngle = 0.0;//所在车道,车应该的朝向角度,北为0,顺时针旋转360,0-360 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;//车道中心线做垂线的点 jf::Point ptOutFoot;//车道中心线做垂线的点
double dCarAngle = objAll.obj.heading; double dCarAngle = 0;
long lOutRaodId; long lOutRaodId;
std::vector<long> vctlOutPreRoadId; std::vector<long> vctlOutPreRoadId;
std::vector<long> vctlOutNxtRoadId; std::vector<long> vctlOutNxtRoadId;
//ROS_INFO("begin call jfxmap"); //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, nLaneCnt, nOutLaneNum, nOutLaneType,
nOutLeftEdgeCrossType, nOutRightEdgeCrossType, nOutLeftEdgeCrossType, nOutRightEdgeCrossType,
nOutSpeedLimit, dOutLaneAngle, ptOutFoot); nOutSpeedLimit, dOutLaneAngle, ptOutFoot);
...@@ -137,5 +136,5 @@ int main(int argc, char* argv[]) ...@@ -137,5 +136,5 @@ int main(int argc, char* argv[])
//} //}
return 0; return 0;
} }
\ No newline at end of file
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