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
|
#ifndef DIFFERENTIAL_DRIVE_CONTROLER_HH
|
||||||
#define DIFFERENTIAL_DRIVE_CONTROLER_HH
|
#define DIFFERENTIAL_DRIVE_CONTROLER_HH
|
||||||
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
/*
|
||||||
|
* PURPOSE: (VehicleController class)
|
||||||
|
*/
|
||||||
#ifndef VEHICLE_CONTROLLER_HH
|
#ifndef VEHICLE_CONTROLLER_HH
|
||||||
#define VEHICLE_CONTROLLER_HH
|
#define VEHICLE_CONTROLLER_HH
|
||||||
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
/*
|
||||||
|
* PURPOSE: (Class to represent a point)
|
||||||
|
*/
|
||||||
#ifndef POINT_HH
|
#ifndef POINT_HH
|
||||||
#define POINT_HH
|
#define POINT_HH
|
||||||
class Point {
|
class Point {
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
/*
|
||||||
|
* PURPOSE: (DCMotorSpeedController class)
|
||||||
|
*/
|
||||||
#ifndef DC_MOTOR_SPEED_CONTROLLER_HH
|
#ifndef DC_MOTOR_SPEED_CONTROLLER_HH
|
||||||
#define DC_MOTOR_SPEED_CONTROLLER_HH
|
#define DC_MOTOR_SPEED_CONTROLLER_HH
|
||||||
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
/*
|
||||||
|
* PURPOSE: (MotorSpeedController class)
|
||||||
|
*/
|
||||||
#ifndef MOTOR_SPEED_CONTROLLER_HH
|
#ifndef MOTOR_SPEED_CONTROLLER_HH
|
||||||
#define MOTOR_SPEED_CONTROLLER_HH
|
#define MOTOR_SPEED_CONTROLLER_HH
|
||||||
|
|
||||||
|
@ -28,10 +28,10 @@ class VehicleOne {
|
|||||||
// Vehicle Controller Parameters
|
// Vehicle Controller Parameters
|
||||||
double slowDownDistance; /* m */
|
double slowDownDistance; /* m */
|
||||||
double arrivalDistance; /* m */
|
double arrivalDistance; /* m */
|
||||||
double wheelSpeedLimit; /* r/s */
|
double wheelSpeedLimit; /* rad/s */
|
||||||
double headingRateLimit; /* r/s */
|
double headingRateLimit; /* rad/s */
|
||||||
double wheelDragConstant; /* */
|
double wheelDragConstant; /* -- */
|
||||||
double corningStiffness; /* */
|
double corningStiffness; /* -- */
|
||||||
|
|
||||||
// DCMotor Parameters
|
// DCMotor Parameters
|
||||||
double DCMotorInternalResistance; /* ohm */
|
double DCMotorInternalResistance; /* ohm */
|
||||||
@ -41,12 +41,12 @@ class VehicleOne {
|
|||||||
double velocity[2]; /* m/s */
|
double velocity[2]; /* m/s */
|
||||||
double acceleration[2]; /* m/s2 */
|
double acceleration[2]; /* m/s2 */
|
||||||
|
|
||||||
double heading; /* r */
|
double heading; /* rad */
|
||||||
double headingRate; /* r/s */
|
double headingRate; /* rad/s */
|
||||||
double headingAccel; /* r/s2 */
|
double headingAccel; /* rad/s2 */
|
||||||
|
|
||||||
double rightMotorSpeed; /* r/s */
|
double rightMotorSpeed; /* rad/s */
|
||||||
double leftMotorSpeed; /* r/s */
|
double leftMotorSpeed; /* rad/s */
|
||||||
|
|
||||||
// Forces
|
// Forces
|
||||||
double driveForce[2]; /* N */
|
double driveForce[2]; /* N */
|
||||||
|
@ -12,9 +12,6 @@ PROGRAMMERS:
|
|||||||
#include "Vehicle/include/vehicleOne.hh"
|
#include "Vehicle/include/vehicleOne.hh"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#ifndef PI
|
|
||||||
#define PI 3.1415926535
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int VehicleOne::default_data() {
|
int VehicleOne::default_data() {
|
||||||
|
|
||||||
@ -28,7 +25,7 @@ int VehicleOne::default_data() {
|
|||||||
slowDownDistance = 0.5;
|
slowDownDistance = 0.5;
|
||||||
arrivalDistance = 0.1;
|
arrivalDistance = 0.1;
|
||||||
wheelSpeedLimit = 8.880;
|
wheelSpeedLimit = 8.880;
|
||||||
headingRateLimit = PI/4;
|
headingRateLimit = M_PI/4;
|
||||||
|
|
||||||
// DCMotor Parameters
|
// DCMotor Parameters
|
||||||
// At 5v the following parameters will result in a current of
|
// At 5v the following parameters will result in a current of
|
||||||
@ -179,7 +176,7 @@ int VehicleOne::state_deriv() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "sim_services/Integrator/include/integrator_c_intf.h"
|
#include "trick/integrator_c_intf.h"
|
||||||
|
|
||||||
int VehicleOne::state_integ() {
|
int VehicleOne::state_integ() {
|
||||||
int integration_step;
|
int integration_step;
|
||||||
@ -217,8 +214,8 @@ int VehicleOne::state_integ() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!integration_step) {
|
if (!integration_step) {
|
||||||
if (heading < -PI) heading += 2*PI;
|
if (heading < -M_PI) heading += 2*M_PI;
|
||||||
if (heading > PI) heading += -2*PI;
|
if (heading > M_PI) heading += -2*M_PI;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(integration_step);
|
return(integration_step);
|
||||||
|
Loading…
Reference in New Issue
Block a user