parent
6a879c89db
commit
8ae9090be2
|
@ -7,6 +7,8 @@
|
|||
|
||||
#include <limits>
|
||||
#include <stdint.h>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#define SQUARE(a) ((a) * (a))
|
||||
#define RATE(MaxY, MinY, DiffX) (((MaxY) - (MinY)) / (DiffX))
|
||||
|
@ -39,6 +41,7 @@ namespace SpeedThreshold {
|
|||
static const float HIGHWAY_SPEED = 50.0f / 3.6f;
|
||||
static const float ARBITRARY_MAX_SPEED = 100.0f / 3.6f;
|
||||
static const float AFTER_JUNCTION_MIN_SPEED = 5.0f / 3.6f;
|
||||
static const float INITIAL_PERCENTAGE_SPEED_DIFFERENCE = 30.0f;
|
||||
} // namespace SpeedThreshold
|
||||
|
||||
namespace PathBufferUpdate {
|
||||
|
@ -51,12 +54,12 @@ static const float HORIZON_RATE = RATE(MAXIMUM_HORIZON_LENGTH,
|
|||
} // namespace PathBufferUpdate
|
||||
|
||||
namespace WaypointSelection {
|
||||
static const float TARGET_WAYPOINT_TIME_HORIZON = 1.0f;
|
||||
static const float TARGET_WAYPOINT_HORIZON_LENGTH = 2.5f;
|
||||
static const float JUNCTION_LOOK_AHEAD = 10.0f;
|
||||
static const float SAFE_DISTANCE_AFTER_JUNCTION = 10.0f;
|
||||
static const float MIN_JUNCTION_LENGTH = 5.0f;
|
||||
static const float MIN_SAFE_INTERVAL_LENGTH = 0.9f * SAFE_DISTANCE_AFTER_JUNCTION;
|
||||
static const float TARGET_WAYPOINT_TIME_HORIZON = 0.3f;
|
||||
static const float TARGET_WAYPOINT_HORIZON_LENGTH = 0.8f;
|
||||
static const float JUNCTION_LOOK_AHEAD = 6.0f;
|
||||
static const float SAFE_DISTANCE_AFTER_JUNCTION = 6.0f;
|
||||
static const float MIN_JUNCTION_LENGTH = 8.0f;
|
||||
static const float MIN_SAFE_INTERVAL_LENGTH = 1.5f * SAFE_DISTANCE_AFTER_JUNCTION;
|
||||
} // namespace WaypointSelection
|
||||
|
||||
namespace LaneChange {
|
||||
|
@ -118,10 +121,15 @@ static const float MAX_JUNCTION_BLOCK_DISTANCE = 0.5f * WaypointSelection::SAFE_
|
|||
namespace PID {
|
||||
static const float MAX_THROTTLE = 0.7f;
|
||||
static const float MAX_BRAKE = 1.0f;
|
||||
static const float STEERING_LIMIT = 0.8f;
|
||||
static const float VELOCITY_INTEGRAL_MAX = 5.0f;
|
||||
static const float VELOCITY_INTEGRAL_MIN = -5.0f;
|
||||
static const float DT = 0.05f;
|
||||
static const float INV_DT = 1.0f / DT;
|
||||
static const std::vector<float> LONGITUDIAL_PARAM = {2.0f, 0.01f, 0.4f};
|
||||
static const std::vector<float> LONGITUDIAL_HIGHWAY_PARAM = {4.0f, 0.02f, 0.2f};
|
||||
static const std::vector<float> LATERAL_PARAM = {9.0f, 0.02f, 1.0f};
|
||||
static const std::vector<float> LATERAL_HIGHWAY_PARAM = {7.0f, 0.02f, 1.0f};
|
||||
} // namespace PID
|
||||
|
||||
namespace TrackTraffic {
|
||||
|
|
|
@ -77,7 +77,7 @@ ActuationSignal RunStep(StateEntry present_state,
|
|||
lateral_parameters[1] * present_state.deviation_integral +
|
||||
lateral_parameters[2] * (present_state.deviation - previous_state.deviation) * INV_DT;
|
||||
|
||||
steer = std::max(-0.8f, std::min(steer, 0.8f));
|
||||
steer = std::max(-STEERING_LIMIT, std::min(steer, STEERING_LIMIT));
|
||||
|
||||
return ActuationSignal{throttle, brake, steer};
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "carla/Sockets.h"
|
||||
#include "carla/client/detail/Simulator.h"
|
||||
|
||||
#include "carla/trafficmanager/Constants.h"
|
||||
#include "carla/trafficmanager/TrafficManager.h"
|
||||
#include "carla/trafficmanager/TrafficManagerBase.h"
|
||||
#include "carla/trafficmanager/TrafficManagerLocal.h"
|
||||
|
@ -21,6 +22,9 @@
|
|||
namespace carla {
|
||||
namespace traffic_manager {
|
||||
|
||||
using namespace constants::SpeedThreshold;
|
||||
using namespace constants::PID;
|
||||
|
||||
std::map<uint16_t, TrafficManagerBase*> TrafficManager::_tm_map;
|
||||
std::mutex TrafficManager::_mutex;
|
||||
|
||||
|
@ -119,11 +123,11 @@ void TrafficManager::CreateTrafficManagerServer(
|
|||
};
|
||||
|
||||
/// Define local constants
|
||||
const std::vector<float> longitudinal_param = {2.0f, 0.01f, 0.4f};
|
||||
const std::vector<float> longitudinal_highway_param = {4.0f, 0.02f, 0.2f};
|
||||
const std::vector<float> lateral_param = {9.0f, 0.02f, 1.0f};
|
||||
const std::vector<float> lateral_highway_param = {7.0f, 0.02f, 1.0f};
|
||||
const float perc_difference_from_limit = 30.0f;
|
||||
const std::vector<float> longitudinal_param = LONGITUDIAL_PARAM;
|
||||
const std::vector<float> longitudinal_highway_param = LONGITUDIAL_HIGHWAY_PARAM;
|
||||
const std::vector<float> lateral_param = LATERAL_PARAM;
|
||||
const std::vector<float> lateral_highway_param = LATERAL_HIGHWAY_PARAM;
|
||||
const float perc_difference_from_limit = INITIAL_PERCENTAGE_SPEED_DIFFERENCE;
|
||||
|
||||
std::pair<std::string, uint16_t> serverTM;
|
||||
|
||||
|
|
Loading…
Reference in New Issue