Skip to content

Commit

Permalink
fix(gnss_poser): updated for space errors
Browse files Browse the repository at this point in the history
Signed-off-by: melike tanrikulu <melike@leodrive.ai>
  • Loading branch information
meliketanrikulu committed Apr 20, 2022
1 parent 4ff419d commit 422f8ef
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions sensing/gnss_poser/include/gnss_poser/convert.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <sensor_msgs/msg/nav_sat_fix.hpp>

#include <string>

namespace gnss_poser
{
enum class MGRSPrecision {
Expand Down Expand Up @@ -62,6 +63,7 @@ GNSSStat NavSatFix2LocalCartesian(
{
GNSSStat local_cartesian;
local_cartesian.coordinate_system = CoordinateSystem::LOCAL_CARTESIAN;

try {
GeographicLib::LocalCartesian localCartesian_origin(
nav_sat_fix_origin.latitude, nav_sat_fix_origin.longitude, nav_sat_fix_origin.altitude);
Expand All @@ -82,11 +84,13 @@ GNSSStat NavSatFix2UTM(
{
GNSSStat utm;
utm.coordinate_system = CoordinateSystem::UTM;

try {
GeographicLib::UTMUPS::Forward(
nav_sat_fix_msg.latitude, nav_sat_fix_msg.longitude, utm.zone, utm.northup, utm.x, utm.y);

utm.z = EllipsoidHeight2OrthometricHeight(nav_sat_fix_msg, logger);

utm.latitude = nav_sat_fix_msg.latitude;
utm.longitude = nav_sat_fix_msg.longitude;
utm.altitude = nav_sat_fix_msg.altitude;
Expand Down
1 change: 1 addition & 0 deletions sensing/gnss_poser/include/gnss_poser/gnss_poser_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class GNSSPoser : public rclcpp::Node
std::string gnss_frame_;
std::string gnss_base_frame_;
std::string map_frame_;

sensor_msgs::msg::NavSatFix nav_sat_fix_origin;
bool use_ublox_receiver_;

Expand Down
2 changes: 1 addition & 1 deletion sensing/gnss_poser/launch/gnss_poser.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<arg name="gnss_frame" default="gnss"/>
<arg name="map_frame" default="map"/>

<arg name="coordinate_system" default="3" description="0:UTM, 1:MGRS, 2:PLANE, 3:LocalCartesian"/>
<arg name="coordinate_system" default="1" description="0:UTM, 1:MGRS, 2:PLANE, 3:LocalCartesian"/>
<arg name="buff_epoch" default="1"/>
<arg name="use_ublox_receiver" default="false"/>
<arg name="plane_zone" default="9"/>
Expand Down
1 change: 0 additions & 1 deletion sensing/gnss_poser/src/gnss_poser_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ GNSSPoser::GNSSPoser(const rclcpp::NodeOptions & node_options)
{
int coordinate_system =
declare_parameter("coordinate_system", static_cast<int>(CoordinateSystem::MGRS));

coordinate_system_ = static_cast<CoordinateSystem>(coordinate_system);

nav_sat_fix_origin.latitude = declare_parameter("latitude", 0.0);
Expand Down

0 comments on commit 422f8ef

Please sign in to comment.