Fixes float conversion in TM

This commit is contained in:
Jacopo Bartiromo 2020-09-24 16:05:54 +02:00 committed by Marc Garcia Puig
parent 79457a6e76
commit 7d91a14fae
2 changed files with 3 additions and 1 deletions

View File

@ -28,6 +28,7 @@ static const double DELTA_TIME_BETWEEN_DESTRUCTIONS = 10.0;
} // namespace VehicleRemoval } // namespace VehicleRemoval
namespace HybridMode { namespace HybridMode {
static const float HYBRID_MODE_DT_FL = 0.05f;
static const double HYBRID_MODE_DT = 0.05; static const double HYBRID_MODE_DT = 0.05;
static const double INV_HYBRID_DT = 1.0 / HYBRID_MODE_DT; static const double INV_HYBRID_DT = 1.0 / HYBRID_MODE_DT;
static const float PHYSICS_RADIUS = 50.0f; static const float PHYSICS_RADIUS = 50.0f;

View File

@ -12,6 +12,7 @@ using namespace constants::WaypointSelection;
using namespace constants::SpeedThreshold; using namespace constants::SpeedThreshold;
using constants::HybridMode::HYBRID_MODE_DT; using constants::HybridMode::HYBRID_MODE_DT;
using constants::HybridMode::HYBRID_MODE_DT_FL;
MotionPlanStage::MotionPlanStage( MotionPlanStage::MotionPlanStage(
const std::vector<ActorId> &vehicle_id_list, const std::vector<ActorId> &vehicle_id_list,
@ -147,7 +148,7 @@ void MotionPlanStage::Update(const unsigned long index) {
if (!emergency_stop && (parameters.GetSynchronousMode() || elapsed_time > HYBRID_MODE_DT)) { if (!emergency_stop && (parameters.GetSynchronousMode() || elapsed_time > HYBRID_MODE_DT)) {
// Target displacement magnitude to achieve target velocity. // Target displacement magnitude to achieve target velocity.
const float target_displacement = dynamic_target_velocity * HYBRID_MODE_DT; const float target_displacement = dynamic_target_velocity * HYBRID_MODE_DT_FL;
const SimpleWaypointPtr teleport_target_waypoint = GetTargetWaypoint(waypoint_buffer, target_displacement).first; const SimpleWaypointPtr teleport_target_waypoint = GetTargetWaypoint(waypoint_buffer, target_displacement).first;
// Construct target transform to accurately achieve desired velocity. // Construct target transform to accurately achieve desired velocity.