fix parsing of OpenDrive geoReference exported by RoadRunner
This commit is contained in:
parent
5dc0a21788
commit
381f03a9a0
|
@ -1,4 +1,5 @@
|
|||
## Latest Changes
|
||||
* Fix parsing of OpenDrive geoReference exported by RoadRunner
|
||||
* Added manual_control_steeringwheel.py to control agents using Logitech G29 steering wheels (and maybe others).
|
||||
* Fixed `manual_control.py` and `no_rendering_mode.py` to prevent crashes when used in "no rendering mode"
|
||||
* Added movable props present in the map (e.g. chairs and tables) as actors so they can be controlled from Python
|
||||
|
|
|
@ -93,16 +93,11 @@ namespace client {
|
|||
if (geo_ref_key_value.size() != 2u) {
|
||||
continue;
|
||||
}
|
||||
std::istringstream istr(geo_ref_key_value[1]);
|
||||
istr.imbue(std::locale("C"));
|
||||
|
||||
if (geo_ref_key_value[0] == "+lat_0") {
|
||||
istr >> _map_latitude;
|
||||
_map_latitude = ParseDouble(geo_ref_key_value[1]);
|
||||
} else if (geo_ref_key_value[0] == "+lon_0") {
|
||||
istr >> _map_longitude;
|
||||
}
|
||||
if (istr.fail() || !istr.eof()) {
|
||||
_map_latitude = std::numeric_limits<double>::quiet_NaN();
|
||||
_map_longitude = std::numeric_limits<double>::quiet_NaN();
|
||||
_map_longitude = ParseDouble(geo_ref_key_value[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,6 +125,17 @@ namespace client {
|
|||
_is_listening = true;
|
||||
}
|
||||
|
||||
double GnssSensor::ParseDouble(std::string const &stringValue) const {
|
||||
double value;
|
||||
std::istringstream istr(stringValue);
|
||||
istr.imbue(std::locale("C"));
|
||||
istr >> value;
|
||||
if (istr.fail() || !istr.eof()) {
|
||||
value = std::numeric_limits<double>::quiet_NaN();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
SharedPtr<sensor::SensorData> GnssSensor::TickGnssSensor(
|
||||
const Timestamp ×tamp) {
|
||||
try {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "carla/client/Sensor.h"
|
||||
#include <string>
|
||||
|
||||
namespace carla {
|
||||
namespace client {
|
||||
|
@ -42,6 +43,8 @@ namespace client {
|
|||
|
||||
SharedPtr<sensor::SensorData> TickGnssSensor(const Timestamp ×tamp);
|
||||
|
||||
double ParseDouble(std::string const &stringValue) const;
|
||||
|
||||
double _map_latitude;
|
||||
|
||||
double _map_longitude;
|
||||
|
|
Loading…
Reference in New Issue