@@ -20,10 +20,10 @@ ErForceSimulator::ErForceSimulator(const TbotsProto::FieldType& field_type,
2020 const robot_constants::RobotConstants& robot_constants,
2121 std::unique_ptr<RealismConfigErForce>& realism_config,
2222 const bool ramping,
23- double primitive_executor_time_step)
23+ Duration primitive_executor_time_step)
2424 : yellow_team_world_msg(std::make_unique<TbotsProto::World>()),
2525 blue_team_world_msg(std::make_unique<TbotsProto::World>()),
26- primitive_executor_time_step_s (primitive_executor_time_step),
26+ primitive_executor_time_step (primitive_executor_time_step),
2727 frame_number(0 ),
2828 euclidean_to_four_wheel(robot_constants),
2929 robot_constants(robot_constants),
@@ -280,14 +280,14 @@ void ErForceSimulator::setRobots(
280280 {
281281 if (side == gameController::Team::BLUE)
282282 {
283- auto robot_primitive_executor = std::make_shared<PrimitiveExecutor>(
284- Duration::fromSeconds (primitive_executor_time_step_s), robot_constants);
283+ auto robot_primitive_executor =
284+ std::make_shared<PrimitiveExecutor>( robot_constants);
285285 blue_primitive_executor_map.insert ({id, robot_primitive_executor});
286286 }
287287 else
288288 {
289- auto robot_primitive_executor = std::make_shared<PrimitiveExecutor>(
290- Duration::fromSeconds (primitive_executor_time_step_s), robot_constants);
289+ auto robot_primitive_executor =
290+ std::make_shared<PrimitiveExecutor>( robot_constants);
291291 yellow_primitive_executor_map.insert ({id, robot_primitive_executor});
292292 }
293293 }
@@ -389,15 +389,17 @@ SSLSimulationProto::RobotControl ErForceSimulator::updateSimulatorRobots(
389389 TbotsProto::PrimitiveExecutorStatus status; // Added for compilation
390390 if (ramping)
391391 {
392- auto direct_control_no_ramp = primitive_executor->stepPrimitive (status);
393- direct_control = getRampedVelocityPrimitive (
394- current_velocity_map.at (robot_id).first ,
395- current_velocity_map.at (robot_id).second , *direct_control_no_ramp,
396- primitive_executor_time_step_s);
392+ auto direct_control_no_ramp =
393+ primitive_executor->stepPrimitive (status, primitive_executor_time_step);
394+ direct_control = getRampedVelocityPrimitive (
395+ current_velocity_map.at (robot_id).first ,
396+ current_velocity_map.at (robot_id).second , *direct_control_no_ramp,
397+ primitive_executor_time_step);
397398 }
398399 else
399400 {
400- direct_control = primitive_executor->stepPrimitive (status);
401+ direct_control =
402+ primitive_executor->stepPrimitive (status, primitive_executor_time_step);
401403 }
402404
403405 auto command = *getRobotCommandFromDirectControl (
@@ -411,8 +413,7 @@ std::unique_ptr<TbotsProto::DirectControlPrimitive>
411413ErForceSimulator::getRampedVelocityPrimitive (
412414 const Vector current_local_velocity,
413415 const AngularVelocity current_local_angular_velocity,
414- TbotsProto::DirectControlPrimitive& target_velocity_primitive,
415- const double & time_to_ramp)
416+ TbotsProto::DirectControlPrimitive& target_velocity_primitive, Duration time_to_ramp)
416417{
417418 TbotsProto::MotorControl_DirectVelocityControl direct_velocity =
418419 target_velocity_primitive.motor_control ().direct_velocity_control ();
@@ -435,7 +436,7 @@ ErForceSimulator::getRampedVelocityPrimitive(
435436 euclidean_to_four_wheel.getWheelVelocity (current_euclidean_velocity);
436437
437438 WheelSpace_t ramped_four_wheel = euclidean_to_four_wheel.rampWheelVelocity (
438- current_wheel_velocity, target_wheel_velocity, time_to_ramp);
439+ current_wheel_velocity, target_wheel_velocity, time_to_ramp. toSeconds () );
439440
440441 EuclideanSpace_t ramped_euclidean =
441442 euclidean_to_four_wheel.getEuclideanVelocity (ramped_four_wheel);
0 commit comments