Apollo 10.0
自动驾驶开放平台
apollo::localization::msf::FrameTransform类 参考

#include <frame_transform.h>

apollo::localization::msf::FrameTransform 的协作图:

静态 Public 成员函数

static bool LatlonToUtmXY (double lon, double lat, UTMCoor *utm_xy)
 
static bool UtmXYToLatlon (double x, double y, int zone, bool southhemi, WGS84Corr *latlon)
 
static bool XYZToBlh (const Vector3d &xyz, Vector3d *blh)
 
static bool BlhToXYZ (const Vector3d &blh, Vector3d *xyz)
 

详细描述

在文件 frame_transform.h44 行定义.

成员函数说明

◆ BlhToXYZ()

bool apollo::localization::msf::FrameTransform::BlhToXYZ ( const Vector3d blh,
Vector3d xyz 
)
static

在文件 frame_transform.cc96 行定义.

96 {
97 projPJ pj_xyz;
98 projPJ pj_blh;
99 std::string blh_src = "+proj=latlong +datum=WGS84";
100 std::string xyz_dst = "+proj=geocent +datum=WGS84";
101
102 if (!(pj_blh = pj_init_plus(blh_src.c_str()))) {
103 return false;
104 }
105 if (!(pj_xyz = pj_init_plus(xyz_dst.c_str()))) {
106 return false;
107 }
108 double longitude = blh[0];
109 double latitude = blh[1];
110 double height = blh[2];
111 pj_transform(pj_blh, pj_xyz, 1, 1, &longitude, &latitude, &height);
112 (*xyz)[0] = longitude;
113 (*xyz)[1] = latitude;
114 (*xyz)[2] = height;
115 pj_free(pj_xyz);
116 pj_free(pj_blh);
117 return true;
118}
uint32_t height
Height of point cloud

◆ LatlonToUtmXY()

bool apollo::localization::msf::FrameTransform::LatlonToUtmXY ( double  lon,
double  lat,
UTMCoor utm_xy 
)
static

在文件 frame_transform.cc27 行定义.

28 {
29 projPJ pj_latlon;
30 projPJ pj_utm;
31 int zone = 0;
32 zone = static_cast<int>((lon_rad * RAD_TO_DEG + 180) / 6) + 1;
33 std::string latlon_src =
34 "+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs";
35 std::string utm_dst =
36 absl::StrCat("+proj=utm +zone=", zone, " +ellps=GRS80 +units=m +no_defs");
37 if (!(pj_latlon = pj_init_plus(latlon_src.c_str()))) {
38 return false;
39 }
40 if (!(pj_utm = pj_init_plus(utm_dst.c_str()))) {
41 return false;
42 }
43 double longitude = lon_rad;
44 double latitude = lat_rad;
45 pj_transform(pj_latlon, pj_utm, 1, 1, &longitude, &latitude, nullptr);
46 utm_xy->x = longitude;
47 utm_xy->y = latitude;
48 pj_free(pj_latlon);
49 pj_free(pj_utm);
50 return true;
51}
#define RAD_TO_DEG

◆ UtmXYToLatlon()

bool apollo::localization::msf::FrameTransform::UtmXYToLatlon ( double  x,
double  y,
int  zone,
bool  southhemi,
WGS84Corr latlon 
)
static

在文件 frame_transform.cc52 行定义.

53 {
54 projPJ pj_latlon;
55 projPJ pj_utm;
56 std::string latlon_src =
57 "+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs";
58 std::string utm_dst =
59 absl::StrCat("+proj=utm +zone=", zone, " +ellps=GRS80 +units=m +no_defs");
60 if (!(pj_latlon = pj_init_plus(latlon_src.c_str()))) {
61 return false;
62 }
63 if (!(pj_utm = pj_init_plus(utm_dst.c_str()))) {
64 return false;
65 }
66 pj_transform(pj_utm, pj_latlon, 1, 1, &x, &y, nullptr);
67 latlon->log = x;
68 latlon->lat = y;
69 pj_free(pj_latlon);
70 pj_free(pj_utm);
71 return true;
72}

◆ XYZToBlh()

bool apollo::localization::msf::FrameTransform::XYZToBlh ( const Vector3d xyz,
Vector3d blh 
)
static

在文件 frame_transform.cc74 行定义.

74 {
75 projPJ pj_xyz;
76 projPJ pj_blh;
77 std::string xyz_src = "+proj=geocent +datum=WGS84";
78 std::string blh_dst = "+proj=latlong +datum=WGS84";
79 if (!(pj_xyz = pj_init_plus(xyz_src.c_str()))) {
80 return false;
81 }
82 if (!(pj_blh = pj_init_plus(blh_dst.c_str()))) {
83 return false;
84 }
85 double x = xyz[0];
86 double y = xyz[1];
87 double z = xyz[2];
88 pj_transform(pj_xyz, pj_blh, 1, 1, &x, &y, &z);
89 (*blh)[0] = x;
90 (*blh)[1] = y;
91 (*blh)[2] = z;
92 pj_free(pj_xyz);
93 pj_free(pj_blh);
94 return true;
95}

该类的文档由以下文件生成: