Starting waypoint's Python API
This commit is contained in:
parent
d0333f8767
commit
66326f7164
|
@ -0,0 +1,30 @@
|
|||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||
// de Barcelona (UAB).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#include "carla/road/Map.h"
|
||||
#include "carla/client/Map.h"
|
||||
#include "carla/opendrive/OpenDrive.h"
|
||||
|
||||
namespace carla {
|
||||
namespace client {
|
||||
|
||||
Map::Map(std::string name, std::string open_drive)
|
||||
: _name(std::move(name)),
|
||||
_open_drive(std::move(open_drive)) {
|
||||
_map = std::make_shared<road::Map>(opendrive::OpenDrive::Load(open_drive));
|
||||
}
|
||||
|
||||
const std::string &Map::GetOpenDrive() const {
|
||||
return _open_drive;
|
||||
}
|
||||
|
||||
// @todo
|
||||
/*detail::Waypoint Map::GetWaypoint(const geom::Location &loc) const {
|
||||
|
||||
}*/
|
||||
|
||||
} // namespace client
|
||||
} // namespace carla
|
|
@ -0,0 +1,49 @@
|
|||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||
// de Barcelona (UAB).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "carla/Memory.h"
|
||||
#include "carla/NonCopyable.h"
|
||||
#include "carla/client/detail/Waypoint.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace carla {
|
||||
namespace road {
|
||||
class Map;
|
||||
}
|
||||
namespace client {
|
||||
|
||||
class Map
|
||||
: public EnableSharedFromThis<Map>,
|
||||
private NonCopyable {
|
||||
private:
|
||||
|
||||
public:
|
||||
|
||||
Map(Map &&) = default;
|
||||
Map &operator=(Map &&) = default;
|
||||
|
||||
const std::string &GetOpenDrive() const;
|
||||
|
||||
detail::Waypoint GetWaypoint(const geom::Location &) const;
|
||||
|
||||
private:
|
||||
|
||||
explicit Map(std::string name, std::string open_drive);
|
||||
|
||||
explicit Map(std::shared_ptr<road::Map> map) : _map(map) {}
|
||||
|
||||
std::string _name;
|
||||
|
||||
std::string _open_drive;
|
||||
|
||||
std::shared_ptr<road::Map> _map;
|
||||
};
|
||||
|
||||
} // namespace client
|
||||
} // namespace carla
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||
// de Barcelona (UAB).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "carla/client/detail/Waypoint.h"
|
||||
|
||||
namespace carla {
|
||||
namespace client {
|
||||
namespace detail {
|
||||
|
||||
Waypoint::~Waypoint() = default; // to ensure we delete _map
|
||||
|
||||
// @todo
|
||||
/*std::vector<Waypoint> Waypoint::NextWaypoints(double dist) {
|
||||
std::vector<Waypoint> v;
|
||||
|
||||
return v;
|
||||
}*/
|
||||
|
||||
} // namespace detail
|
||||
} // namespace client
|
||||
} // namespace carla
|
|
@ -0,0 +1,61 @@
|
|||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||
// de Barcelona (UAB).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "carla/Memory.h"
|
||||
#include "carla/geom/Location.h"
|
||||
|
||||
namespace carla {
|
||||
namespace client {
|
||||
class Map;
|
||||
namespace detail {
|
||||
|
||||
struct Info {
|
||||
size_t _id;
|
||||
double _speed_limit;
|
||||
double _width;
|
||||
double _heading;
|
||||
};
|
||||
|
||||
class Waypoint {
|
||||
public:
|
||||
|
||||
Waypoint()
|
||||
: _pos(),
|
||||
_heading(0.0) {}
|
||||
|
||||
Waypoint(const geom::Location &p)
|
||||
: _pos(p),
|
||||
_heading(0.0) {}
|
||||
|
||||
Waypoint(const geom::Location &p, double heading)
|
||||
: _pos(p),
|
||||
_heading(heading) {}
|
||||
|
||||
~Waypoint();
|
||||
|
||||
std::vector<Waypoint> NextWaypoints(double dist);
|
||||
|
||||
const Info &GetInfo() {
|
||||
return _info;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
geom::Location _pos;
|
||||
|
||||
double _heading;
|
||||
|
||||
Info _info;
|
||||
|
||||
SharedPtr<Map> _map;
|
||||
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace client
|
||||
} // namespace carla
|
Loading…
Reference in New Issue