mirror of
https://github.com/nasa/trick.git
synced 2024-12-20 21:53:10 +00:00
Updates for SIM_wheelbot. Ref #438
This commit is contained in:
parent
876075e325
commit
11aa54d4a4
@ -1,3 +1,6 @@
|
||||
/*
|
||||
* PURPOSE: (DifferentialDriveController class)
|
||||
*/
|
||||
#ifndef DIFFERENTIAL_DRIVE_CONTROLER_HH
|
||||
#define DIFFERENTIAL_DRIVE_CONTROLER_HH
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
/*
|
||||
* PURPOSE: (VehicleController class)
|
||||
*/
|
||||
#ifndef VEHICLE_CONTROLLER_HH
|
||||
#define VEHICLE_CONTROLLER_HH
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
/*
|
||||
* PURPOSE: (Class to represent a point)
|
||||
*/
|
||||
#ifndef POINT_HH
|
||||
#define POINT_HH
|
||||
class Point {
|
||||
|
@ -1,3 +1,6 @@
|
||||
/*
|
||||
* PURPOSE: (DCMotorSpeedController class)
|
||||
*/
|
||||
#ifndef DC_MOTOR_SPEED_CONTROLLER_HH
|
||||
#define DC_MOTOR_SPEED_CONTROLLER_HH
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
/*
|
||||
* PURPOSE: (MotorSpeedController class)
|
||||
*/
|
||||
#ifndef MOTOR_SPEED_CONTROLLER_HH
|
||||
#define MOTOR_SPEED_CONTROLLER_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 */
|
||||
|
@ -12,9 +12,6 @@ PROGRAMMERS:
|
||||
#include "Vehicle/include/vehicleOne.hh"
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
#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);
|
||||
|
Loading…
Reference in New Issue
Block a user