From 11aa54d4a4d0e05c0ef04ab4bbdc730a53362dda Mon Sep 17 00:00:00 2001 From: "John M. Penn" Date: Tue, 6 Jun 2017 14:20:12 -0500 Subject: [PATCH] Updates for SIM_wheelbot. Ref #438 --- .../include/differentialDriveController.hh | 3 +++ .../Control/include/vehicleController.hh | 3 +++ .../models/Guidance/include/point.hh | 3 +++ .../Motor/include/DCMotorSpeedController.hh | 3 +++ .../Motor/include/motorSpeedController.hh | 3 +++ .../models/Vehicle/include/vehicleOne.hh | 18 +++++++++--------- .../models/Vehicle/src/vehicleOne.cpp | 11 ++++------- 7 files changed, 28 insertions(+), 16 deletions(-) diff --git a/trick_sims/SIM_wheelbot/models/Control/include/differentialDriveController.hh b/trick_sims/SIM_wheelbot/models/Control/include/differentialDriveController.hh index 50e75ef4..1177bd8c 100644 --- a/trick_sims/SIM_wheelbot/models/Control/include/differentialDriveController.hh +++ b/trick_sims/SIM_wheelbot/models/Control/include/differentialDriveController.hh @@ -1,3 +1,6 @@ +/* + * PURPOSE: (DifferentialDriveController class) + */ #ifndef DIFFERENTIAL_DRIVE_CONTROLER_HH #define DIFFERENTIAL_DRIVE_CONTROLER_HH diff --git a/trick_sims/SIM_wheelbot/models/Control/include/vehicleController.hh b/trick_sims/SIM_wheelbot/models/Control/include/vehicleController.hh index d94ea5c6..5191f7a9 100644 --- a/trick_sims/SIM_wheelbot/models/Control/include/vehicleController.hh +++ b/trick_sims/SIM_wheelbot/models/Control/include/vehicleController.hh @@ -1,3 +1,6 @@ +/* + * PURPOSE: (VehicleController class) + */ #ifndef VEHICLE_CONTROLLER_HH #define VEHICLE_CONTROLLER_HH diff --git a/trick_sims/SIM_wheelbot/models/Guidance/include/point.hh b/trick_sims/SIM_wheelbot/models/Guidance/include/point.hh index a3bcfa7c..a07a7c0b 100644 --- a/trick_sims/SIM_wheelbot/models/Guidance/include/point.hh +++ b/trick_sims/SIM_wheelbot/models/Guidance/include/point.hh @@ -1,3 +1,6 @@ +/* + * PURPOSE: (Class to represent a point) + */ #ifndef POINT_HH #define POINT_HH class Point { diff --git a/trick_sims/SIM_wheelbot/models/Motor/include/DCMotorSpeedController.hh b/trick_sims/SIM_wheelbot/models/Motor/include/DCMotorSpeedController.hh index 5506be0f..00d65249 100644 --- a/trick_sims/SIM_wheelbot/models/Motor/include/DCMotorSpeedController.hh +++ b/trick_sims/SIM_wheelbot/models/Motor/include/DCMotorSpeedController.hh @@ -1,3 +1,6 @@ +/* + * PURPOSE: (DCMotorSpeedController class) + */ #ifndef DC_MOTOR_SPEED_CONTROLLER_HH #define DC_MOTOR_SPEED_CONTROLLER_HH diff --git a/trick_sims/SIM_wheelbot/models/Motor/include/motorSpeedController.hh b/trick_sims/SIM_wheelbot/models/Motor/include/motorSpeedController.hh index 2a2b5365..51581d56 100644 --- a/trick_sims/SIM_wheelbot/models/Motor/include/motorSpeedController.hh +++ b/trick_sims/SIM_wheelbot/models/Motor/include/motorSpeedController.hh @@ -1,3 +1,6 @@ +/* + * PURPOSE: (MotorSpeedController class) + */ #ifndef MOTOR_SPEED_CONTROLLER_HH #define MOTOR_SPEED_CONTROLLER_HH diff --git a/trick_sims/SIM_wheelbot/models/Vehicle/include/vehicleOne.hh b/trick_sims/SIM_wheelbot/models/Vehicle/include/vehicleOne.hh index ddb0b7f1..f1290742 100644 --- a/trick_sims/SIM_wheelbot/models/Vehicle/include/vehicleOne.hh +++ b/trick_sims/SIM_wheelbot/models/Vehicle/include/vehicleOne.hh @@ -28,10 +28,10 @@ class VehicleOne { // Vehicle Controller Parameters double slowDownDistance; /* m */ double arrivalDistance; /* m */ - double wheelSpeedLimit; /* r/s */ - double headingRateLimit; /* r/s */ - double wheelDragConstant; /* */ - double corningStiffness; /* */ + double wheelSpeedLimit; /* rad/s */ + double headingRateLimit; /* rad/s */ + double wheelDragConstant; /* -- */ + double corningStiffness; /* -- */ // DCMotor Parameters double DCMotorInternalResistance; /* ohm */ @@ -41,12 +41,12 @@ class VehicleOne { double velocity[2]; /* m/s */ double acceleration[2]; /* m/s2 */ - double heading; /* r */ - double headingRate; /* r/s */ - double headingAccel; /* r/s2 */ + double heading; /* rad */ + double headingRate; /* rad/s */ + double headingAccel; /* rad/s2 */ - double rightMotorSpeed; /* r/s */ - double leftMotorSpeed; /* r/s */ + double rightMotorSpeed; /* rad/s */ + double leftMotorSpeed; /* rad/s */ // Forces double driveForce[2]; /* N */ diff --git a/trick_sims/SIM_wheelbot/models/Vehicle/src/vehicleOne.cpp b/trick_sims/SIM_wheelbot/models/Vehicle/src/vehicleOne.cpp index a0896405..319ceaba 100644 --- a/trick_sims/SIM_wheelbot/models/Vehicle/src/vehicleOne.cpp +++ b/trick_sims/SIM_wheelbot/models/Vehicle/src/vehicleOne.cpp @@ -12,9 +12,6 @@ PROGRAMMERS: #include "Vehicle/include/vehicleOne.hh" #include #include -#ifndef PI -#define PI 3.1415926535 -#endif int VehicleOne::default_data() { @@ -28,7 +25,7 @@ int VehicleOne::default_data() { slowDownDistance = 0.5; arrivalDistance = 0.1; wheelSpeedLimit = 8.880; - headingRateLimit = PI/4; + headingRateLimit = M_PI/4; // DCMotor Parameters // At 5v the following parameters will result in a current of @@ -179,7 +176,7 @@ int VehicleOne::state_deriv() { return 0; } -#include "sim_services/Integrator/include/integrator_c_intf.h" +#include "trick/integrator_c_intf.h" int VehicleOne::state_integ() { int integration_step; @@ -217,8 +214,8 @@ int VehicleOne::state_integ() { ); if (!integration_step) { - if (heading < -PI) heading += 2*PI; - if (heading > PI) heading += -2*PI; + if (heading < -M_PI) heading += 2*M_PI; + if (heading > M_PI) heading += -2*M_PI; } return(integration_step);