Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

PhysicalMomentumWheel Class Reference

#include <PhysicalMomentumWheel.h>

Inheritance diagram for PhysicalMomentumWheel:

Inheritance graph
[legend]
Collaboration diagram for PhysicalMomentumWheel:

Collaboration graph
[legend]
List of all members.

Detailed Description

Class to interact with actual harware momentum wheels

Definition at line 53 of file PhysicalMomentumWheel.h.

Public Member Functions

 PhysicalMomentumWheel ()
 Default Constructor.
virtual ~PhysicalMomentumWheel ()
 Default Deconstructor.
int Initialize ()
 Initialize the wheel and its chain.
int Deinitialize ()
 Deinitialize the wheel and its chain.
int Reset ()
 Total System Reset for wheel motor.
int ChangeBaud ()
int EchoOn ()
 Set ECHO to on. Echo input data back out main channel.
int EchoOff ()
 Set ECHO to off. Do not echo input data back out main channel.
int EnableTorqueMode ()
 Enable torque mode for the wheel motor.
int TorqueCommand (double _power)
 Enable torque mode for the wheel motor.
int Stop ()
 Stop the wheel. The function resets the settings for the wheel motor. Not a good method, but works.
void StartSpeedQuery ()
 Start the speed reading routine of the motor in a separate thread Each wheel's speed query needs to be started individually. The performance occurs when the spart calls for each wheel are spread evenly.
void StopSpeedQuery ()
 Stop the speed reading routine of the motor. This function does not need to be called a t the end of the program. The thread will be closed automatically when the program ends.
void CommandWheelTorque (double _wheelTorque)
 Command a torque to the wheel.
void StartTorqueController ()
 Start the torque controller. It is called in the CommandWheelTorque function.
void StopTorqueController ()
 End the Torque Controller Thread.
void SetWheelSpeed (double desiredWheelSpeed)
 Set wheel speed.
void CommandWheelSpeed ()
 Command a speed to the wheel. Retrieves wheelspeed from double m_DesiredWheelSpeed.
void StartPID ()
 Start the PID controller in a separate thread.
void StopPID ()
 End the PID Control Thread (will be called by the deconstructor).
void CommandSystemTorque (double wheelTorque)
 Old-style Command a torque to the wheel.
void SetWheelTorqueLimits (const double &minWheelTorque, const double &maxWheelTorque)
 Set the maximun and minimum torques to be applied to the wheel.
void SetMaxTorqueStep (const double maxTorqueStep)
 Set the maximum change between the current and desired torque values.
void SetWheelAddress (int WheelAddress)
 Set the address of the wheel in the daisy chain.
void SetDaisyChainNumber (int DaisyChainNumber)
 Set a daisy chain number to distinguish between two or more daisy chains.
void SetDaisyChainPort (string DaisyChainPort)
 Set the port to which the wheel's chain is connected.
void SetBiasSpeed (double BiasSpeed)
 Set the bais speed of the wheel for a momentum wheel.
void SetAxialInertia (double _inertia)
 Set the axial inertia of the wheel.
void SetWheelName (string _wheelName)
 Set the momentum wheel string name.
void SetWheelSpeedCoefficients (Vector _Coefficients1, Vector _Coefficients2, Vector _Coefficients3, Vector _Coefficients4)
 Set the momentum wheel speed coefficients. The wheel speed coefficients are determined from the characterization of each wheel motor.
void GetWheelSpeed (double &Speed, double &measTime)
double QueryWheelTorque ()
 Returns a double representing the current torque to the wheel in N-m.
void GetAxialInertia (double &_inertia)
 Get wheel inertia.
double GetAxialInertia ()
 Returns a type double of wheel inertia kg-m^2.
string GetWheelName ()
 Returns a type string of the wheel name.
void GetWheelTorqueLimits (double &minWheelTorque, double &maxWheelTorque)
 Sets the parameters to the min and max torque limits.
void GetMaxTorqueStep (double &maxTorqueStep)
 Sets the parameter maxTorqueStep to the maximum allowed torque step in N-m.
int GetWheelFD ()
 Get the Wheel file descriptor.
double GetAmps ()
 Get the amps reported by the motor.
double GetVolts ()
 Get the voltage the motor.
virtual int GetWheelCount ()
bool IsActive ()
 Returns the current state of m_bActiveState.
Vector GetLocation () const
 Returns the physical location of the device with respect to whorl body coordinates.
void SetLocation (const Vector &newDeviceLocation)
 Specify the physical location of the device with respect to whorl body coordinates.

Static Public Attributes

const bool c_bNotActive = false
 a constant bool that is equal to false.
const bool c_bActive = true
 a constant bool that is equal to true.

Protected Attributes

char * name

Private Attributes

double m_CurrentWheelSpeed
 Member double that holds the current angular wheel speed in rad/sec.
double m_VelocityTime
 Memeber double holds the time of velcotiy measurement in seconds from unix epoch.
double m_DesiredWheelSpeed
 Member double that holds the desired angular wheel speed in rad/sec.
double m_MaxWheelTorque
 Member double that holds the maximum output torque in N-m.
double m_MinWheelTorque
 Member double that holds the minimum output torque in N-m.
double m_CurrentWheelTorque
 Member double that holds the current ouput torque in N-m.
double m_DesiredWheelTorque
 Desired wheel Torque.
double m_AxialInertia
 Member double that holds the axial Inertia in kg-m^2.
int m_BiasFlag
 Member integer Bias speed set flag.
double m_BiasSpeed
 Momentum Wheel bias speed.
int m_WheelAddress
 Member integer that holds the address of the wheel on its daisy chain.
int m_DaisyChainNumber
 Member integer that holds which daisy chain the wheel is on.
int m_fd
 Member integer that holds the file descriptor for all wheels.
string m_DaisyChainPort
 Member string that hold which port the wheel is connected to.
double m_MinVolts
 Member double that hold minimum volts of the reaction wheel motor.
double m_MaxAmps
 Member double that hold maximum current of the reaction wheel motor.
string m_WheelName
 Member double that hold maximum current of the reaction wheel motor.
pthread_t m_PIDThreadID
 Member pthread id for splitting off PID control.
pthread_t m_SpeedThreadID
 Member pthread for splitting off speed queries.
pthread_t m_TorqueThreadID
 Member pthread for Torque Controller.
pthread_mutex_t m_Mutex
 Memeber mutex lock variable.
int m_exitConditionSpeed
int m_exitConditionTorque
double LAST_VEL
 Member double that holds the last angular velocity of the wheel, used in PID controller.
double LAST_TOR
 Member double that holds the last applied wheel torque, used in PID controller.
double LAST_ERR
 Member double that holds the last velocity error, used by the PID controller.
double LAST_VOLT
 Member double that holds the last voltage, used by PID controller.
double m_MaxTorqueStep
 Member double that holds the largest permissable torque change in N-m.
int m_TorqueControlFlag
 Member integer Torque Control flag, used in Torque Controller.
double m_TorqueControllerDeltaTime
 Delta Time to produce Desired Control Torque, used in Torque Controller [s].
double m_TorqueControllerTorqueGain
 Proportional Torque Gain (to tune function to supply torques closer to actual N-m).
double m_TorqueControllerNegativeTimeGain
 Negative Time Gain.
double m_TorqueControllerSteadyStateGain
 Steady State Gain [rad/s].
int m_TorqueControllerDesiredWheelSpeedFlag
 Member integer Torque Control Wheel Speed flag, used in Torque Controller.
Vector m_Coefficients1
Vector m_Coefficients2
Vector m_Coefficients3
Vector m_Coefficients4

Friends

void * QueryWheelSpeed (void *arg)
 Friend function split in a new thread that queries the wheel speed repeatedly. It begins running in the StartSpeedQuery function. Velocity by Position: This function determines the velocity of the wheel by differentiating the position reported by the wheel. The function asks the wheel for its position and then gets the time of day at which the measurement is reported. The code then delays for a small time and asks for the position and gets the time again. The velocity is then calculated by dividing the change in position byt he change in time. The return value is the velocity in rev/sec.
void * RunTorqueController (void *arg)
 Determine reaction wheel speed to provide the desired torque requested from controller.
void * RunTorqueControllerRev (void *arg)
void * RunPIDController (void *arg)
 Friend function that is spawned in a new thread in order to run the PID controller. It is called internally by the CommandWheelSpeed() function. PID controller to set momentum wheel angular velocity. Runs in a separate thread created by by the CommandWheelSpeed() function. THis function is a friend to the PhyicalMomentumWheel class. Once created it will run indefinitely until either a new speed is requested or the end of the program is reached.


Constructor & Destructor Documentation

PhysicalMomentumWheel::PhysicalMomentumWheel  ) 
 

Default Constructor.

Definition at line 19 of file PhysicalMomentumWheel.cpp.

References CAMdoubleVector::initialize(), LAST_ERR, LAST_TOR, LAST_VEL, LAST_VOLT, m_BiasFlag, m_Coefficients1, m_Coefficients2, m_Coefficients3, m_Coefficients4, m_CurrentWheelSpeed, m_exitConditionSpeed, m_exitConditionTorque, m_fd, m_MaxAmps, m_MaxTorqueStep, m_MaxWheelTorque, m_MinVolts, m_MinWheelTorque, m_Mutex, m_TorqueControlFlag, m_TorqueControllerDeltaTime, m_TorqueControllerDesiredWheelSpeedFlag, m_TorqueControllerNegativeTimeGain, m_TorqueControllerSteadyStateGain, and m_TorqueControllerTorqueGain.

PhysicalMomentumWheel::~PhysicalMomentumWheel  )  [virtual]
 

Default Deconstructor.

Definition at line 65 of file PhysicalMomentumWheel.cpp.

References Deinitialize().


Member Function Documentation

int PhysicalMomentumWheel::ChangeBaud  ) 
 

Definition at line 163 of file PhysicalMomentumWheel.cpp.

References hear(), m_fd, m_Mutex, m_WheelName, and say().

Referenced by Initialize().

void PhysicalMomentumWheel::CommandSystemTorque double  wheelTorque  ) 
 

Old-style Command a torque to the wheel.

Parameters:
wheelTorque double representing the desired torque output in N-m

Definition at line 1014 of file PhysicalMomentumWheel.cpp.

References abs, LAST_TOR, m_CurrentWheelTorque, m_fd, m_MaxTorqueStep, m_Mutex, and say().

Referenced by MomentumWheel::SetSystemTorque().

void PhysicalMomentumWheel::CommandWheelSpeed  ) 
 

Command a speed to the wheel. Retrieves wheelspeed from double m_DesiredWheelSpeed.

Definition at line 779 of file PhysicalMomentumWheel.cpp.

References GetAmps(), GetVolts(), LAST_VOLT, m_DesiredWheelSpeed, m_WheelName, and TorqueCommand().

Referenced by Initialize(), RunTorqueController(), RunTorqueControllerRev(), and MomentumWheel::SetWheelSpeed().

void PhysicalMomentumWheel::CommandWheelTorque double  _wheelTorque  ) 
 

Command a torque to the wheel.

Parameters:
_wheelTorque double representing the desired torque output in N-m

Definition at line 374 of file PhysicalMomentumWheel.cpp.

References m_DesiredWheelTorque, m_Mutex, m_TorqueControlFlag, and StartTorqueController().

Referenced by MomentumWheel::SetWheelTorque().

int PhysicalMomentumWheel::Deinitialize  )  [virtual]
 

Deinitialize the wheel and its chain.

Reimplemented from Device.

Definition at line 122 of file PhysicalMomentumWheel.cpp.

References m_fd, m_Mutex, m_WheelName, Stop(), StopSpeedQuery(), and StopTorqueController().

Referenced by ~PhysicalMomentumWheel().

int PhysicalMomentumWheel::EchoOff  ) 
 

Set ECHO to off. Do not echo input data back out main channel.

Definition at line 196 of file PhysicalMomentumWheel.cpp.

References m_fd, m_Mutex, m_WheelName, and say().

Referenced by Initialize().

int PhysicalMomentumWheel::EchoOn  ) 
 

Set ECHO to on. Echo input data back out main channel.

Definition at line 181 of file PhysicalMomentumWheel.cpp.

References m_fd, m_Mutex, m_WheelName, and say().

int PhysicalMomentumWheel::EnableTorqueMode  ) 
 

Enable torque mode for the wheel motor.

Definition at line 211 of file PhysicalMomentumWheel.cpp.

References m_fd, m_Mutex, m_WheelName, and say().

Referenced by Initialize().

double PhysicalMomentumWheel::GetAmps  ) 
 

Get the amps reported by the motor.

Definition at line 1186 of file PhysicalMomentumWheel.cpp.

References hear(), m_fd, m_Mutex, and say().

Referenced by CommandWheelSpeed(), and MomentumWheel::GetAmps().

double PhysicalMomentumWheel::GetAxialInertia  ) 
 

Returns a type double of wheel inertia kg-m^2.

Definition at line 1157 of file PhysicalMomentumWheel.cpp.

void PhysicalMomentumWheel::GetAxialInertia double &  _inertia  ) 
 

Get wheel inertia.

Parameters:
_inertia is the axial inertia kg-m^2

Definition at line 1152 of file PhysicalMomentumWheel.cpp.

Referenced by MomentumWheel::GetAxialInertia(), and RunTorqueController().

Vector Device::GetLocation  )  const [inherited]
 

Returns the physical location of the device with respect to whorl body coordinates.

Returns:
Physical center of the device [x,y,z]^T (meters).

Definition at line 75 of file Device.cpp.

References O_SESSAME::Vector.

void PhysicalMomentumWheel::GetMaxTorqueStep double &  maxTorqueStep  ) 
 

Sets the parameter maxTorqueStep to the maximum allowed torque step in N-m.

Parameters:
maxTorqueStep 

Definition at line 1175 of file PhysicalMomentumWheel.cpp.

double PhysicalMomentumWheel::GetVolts  ) 
 

Get the voltage the motor.

Definition at line 1218 of file PhysicalMomentumWheel.cpp.

References hear(), m_fd, m_Mutex, and say().

Referenced by CommandWheelSpeed(), and MomentumWheel::GetVolts().

virtual int Actuator::GetWheelCount  )  [inline, virtual, inherited]
 

Reimplemented in MomentumWheel.

Definition at line 27 of file Actuator.h.

int PhysicalMomentumWheel::GetWheelFD  ) 
 

Get the Wheel file descriptor.

Definition at line 1181 of file PhysicalMomentumWheel.cpp.

Referenced by MomentumWheel::GetWheelFD().

string PhysicalMomentumWheel::GetWheelName  ) 
 

Returns a type string of the wheel name.

Definition at line 1162 of file PhysicalMomentumWheel.cpp.

Referenced by MomentumWheel::GetWheelName().

void PhysicalMomentumWheel::GetWheelSpeed double &  Speed,
double &  measTime
 

/brief Returns the most current speed reported by the wheel, a double in rad/sec

Parameters:
Speed double set to the current wheel speed
measTime double set to the number of seconds since unix epoch when the velocity waas measured

Definition at line 1117 of file PhysicalMomentumWheel.cpp.

References m_Mutex.

Referenced by MomentumWheel::GetWheelSpeed().

void PhysicalMomentumWheel::GetWheelTorqueLimits double &  minWheelTorque,
double &  maxWheelTorque
 

Sets the parameters to the min and max torque limits.

Parameters:
minWheelTorque Set to the minimum allowed wheel torque in N-m
maxWheelTorque Set to the maximum allowed wheel torque in N-m

Definition at line 1167 of file PhysicalMomentumWheel.cpp.

int PhysicalMomentumWheel::Initialize  )  [virtual]
 

Initialize the wheel and its chain.

Reimplemented from Actuator.

Definition at line 77 of file PhysicalMomentumWheel.cpp.

References ChangeBaud(), CommandWheelSpeed(), EchoOff(), EnableTorqueMode(), init_serial(), m_DaisyChainPort, m_DesiredWheelSpeed, m_fd, m_WheelName, Reset(), and StartSpeedQuery().

Referenced by MomentumWheel::Initialize().

bool Device::IsActive  )  [inherited]
 

Returns the current state of m_bActiveState.

Author:
Andrew Turner
Date:
March 25, 1999 This member function is used to inspect the state of the device External Methods Called: None Assumptions: None

Definition at line 59 of file Device.cpp.

Referenced by Device::Device().

double PhysicalMomentumWheel::QueryWheelTorque  ) 
 

Returns a double representing the current torque to the wheel in N-m.

Definition at line 1126 of file PhysicalMomentumWheel.cpp.

References hear(), m_CurrentWheelTorque, m_fd, m_Mutex, and say().

Referenced by MomentumWheel::GetWheelTorque().

int PhysicalMomentumWheel::Reset  ) 
 

Total System Reset for wheel motor.

Definition at line 148 of file PhysicalMomentumWheel.cpp.

References m_fd, m_Mutex, m_WheelName, and say().

Referenced by Initialize(), and Stop().

void PhysicalMomentumWheel::SetAxialInertia double  _inertia  ) 
 

Set the axial inertia of the wheel.

Parameters:
_inertia the spin axis ineria in kg-m^2

Definition at line 1096 of file PhysicalMomentumWheel.cpp.

References m_AxialInertia.

Referenced by MomentumWheel::SetAxialInertia().

void PhysicalMomentumWheel::SetBiasSpeed double  BiasSpeed  ) 
 

Set the bais speed of the wheel for a momentum wheel.

Parameters:
BiasSpeed [rad/s]

Definition at line 1087 of file PhysicalMomentumWheel.cpp.

References m_BiasFlag, and m_BiasSpeed.

Referenced by MomentumWheel::SetBiasSpeed().

void PhysicalMomentumWheel::SetDaisyChainNumber int  DaisyChainNumber  ) 
 

Set a daisy chain number to distinguish between two or more daisy chains.

Parameters:
DaisyChainNumber 

Definition at line 1076 of file PhysicalMomentumWheel.cpp.

References m_DaisyChainNumber.

Referenced by MomentumWheel::SetChainNumber().

void PhysicalMomentumWheel::SetDaisyChainPort string  DaisyChainPort  ) 
 

Set the port to which the wheel's chain is connected.

Parameters:
DaisyChainPort The string perpresenting the port loaction, S0 for serial 1, USB1 for usb port 2, etc

Definition at line 1082 of file PhysicalMomentumWheel.cpp.

References m_DaisyChainPort.

Referenced by MomentumWheel::SetPort().

void Device::SetLocation const Vector newDeviceLocation  )  [inherited]
 

Specify the physical location of the device with respect to whorl body coordinates.

Parameters:
newDeviceLocation Physical center of the device [x,y,z]^T (meters).

Definition at line 67 of file Device.cpp.

References Device::m_Location, and O_SESSAME::Vector.

void PhysicalMomentumWheel::SetMaxTorqueStep const double  maxTorqueStep  ) 
 

Set the maximum change between the current and desired torque values.

Parameters:
maxTorqueStep The maximun allowed cahnge in torque in N-m

Definition at line 1066 of file PhysicalMomentumWheel.cpp.

References m_MaxTorqueStep.

void PhysicalMomentumWheel::SetWheelAddress int  WheelAddress  ) 
 

Set the address of the wheel in the daisy chain.

Parameters:
WheelAddress integer representing the address of the wheel

Definition at line 1071 of file PhysicalMomentumWheel.cpp.

References m_WheelAddress.

Referenced by MomentumWheel::SetWheelAddress().

void PhysicalMomentumWheel::SetWheelName string  _wheelName  ) 
 

Set the momentum wheel string name.

Parameters:
_wheelName A string naming the wheel

Definition at line 1101 of file PhysicalMomentumWheel.cpp.

References m_WheelName.

Referenced by MomentumWheel::SetWheelName().

void PhysicalMomentumWheel::SetWheelSpeed double  desiredWheelSpeed  ) 
 

Set wheel speed.

Parameters:
desiredWheelSpeed 

Definition at line 772 of file PhysicalMomentumWheel.cpp.

References m_DesiredWheelSpeed, and m_Mutex.

Referenced by RunTorqueController(), and MomentumWheel::SetWheelSpeed().

void PhysicalMomentumWheel::SetWheelSpeedCoefficients Vector  _Coefficients1,
Vector  _Coefficients2,
Vector  _Coefficients3,
Vector  _Coefficients4
 

Set the momentum wheel speed coefficients. The wheel speed coefficients are determined from the characterization of each wheel motor.

Parameters:
_Coefficients1 a 4x1 vector of constants
_Coefficients2 a 3x1 vector of constants
_Coefficients3 a 3x1 vector of constants
_Coefficients4 a 4x1 vector of constants

Definition at line 1106 of file PhysicalMomentumWheel.cpp.

References _, and O_SESSAME::Vector.

Referenced by MomentumWheel::SetWheelSpeedCoefficients().

void PhysicalMomentumWheel::SetWheelTorqueLimits const double &  minWheelTorque,
const double &  maxWheelTorque
 

Set the maximun and minimum torques to be applied to the wheel.

Parameters:
minWheelTorque The minimum torque that should be applied to the wheel in N-m
maxWheelTorque The maaximum torque that shoul be applied to the wheel in N-m

Definition at line 1059 of file PhysicalMomentumWheel.cpp.

References m_MaxWheelTorque, and m_MinWheelTorque.

Referenced by MomentumWheel::SetWheelTorqueLimits().

void PhysicalMomentumWheel::StartPID  ) 
 

Start the PID controller in a separate thread.

Definition at line 871 of file PhysicalMomentumWheel.cpp.

References m_PIDThreadID, and RunPIDController.

Referenced by MomentumWheel::StartPID().

void PhysicalMomentumWheel::StartSpeedQuery  ) 
 

Start the speed reading routine of the motor in a separate thread Each wheel's speed query needs to be started individually. The performance occurs when the spart calls for each wheel are spread evenly.

Definition at line 244 of file PhysicalMomentumWheel.cpp.

References m_SpeedThreadID, and QueryWheelSpeed.

Referenced by Initialize(), and MomentumWheel::StartSpeedQuery().

void PhysicalMomentumWheel::StartTorqueController  ) 
 

Start the torque controller. It is called in the CommandWheelTorque function.

Definition at line 389 of file PhysicalMomentumWheel.cpp.

References m_TorqueThreadID, and RunTorqueControllerRev.

Referenced by CommandWheelTorque().

int PhysicalMomentumWheel::Stop  )  [virtual]
 

Stop the wheel. The function resets the settings for the wheel motor. Not a good method, but works.

Implements Actuator.

Definition at line 237 of file PhysicalMomentumWheel.cpp.

References m_Mutex, and Reset().

Referenced by Deinitialize(), and MomentumWheel::Stop().

void PhysicalMomentumWheel::StopPID  ) 
 

End the PID Control Thread (will be called by the deconstructor).

Definition at line 1008 of file PhysicalMomentumWheel.cpp.

References m_Mutex, and m_PIDThreadID.

Referenced by MomentumWheel::StopPID().

void PhysicalMomentumWheel::StopSpeedQuery  ) 
 

Stop the speed reading routine of the motor. This function does not need to be called a t the end of the program. The thread will be closed automatically when the program ends.

Definition at line 364 of file PhysicalMomentumWheel.cpp.

References m_exitConditionSpeed, m_Mutex, and m_SpeedThreadID.

Referenced by Deinitialize(), and MomentumWheel::StopSpeedQuery().

void PhysicalMomentumWheel::StopTorqueController  ) 
 

End the Torque Controller Thread.

Definition at line 763 of file PhysicalMomentumWheel.cpp.

References m_exitConditionTorque, m_Mutex, and m_TorqueThreadID.

Referenced by Deinitialize().

int PhysicalMomentumWheel::TorqueCommand double  _power  ) 
 

Enable torque mode for the wheel motor.

Parameters:
_power is the voltage to be commanded in Torque Mode

Definition at line 226 of file PhysicalMomentumWheel.cpp.

References m_fd, m_Mutex, and say().

Referenced by CommandWheelSpeed(), RunPIDController(), and MomentumWheel::TorqueCommand().


Friends And Related Function Documentation

void* QueryWheelSpeed void *  arg  )  [friend]
 

Friend function split in a new thread that queries the wheel speed repeatedly. It begins running in the StartSpeedQuery function. Velocity by Position: This function determines the velocity of the wheel by differentiating the position reported by the wheel. The function asks the wheel for its position and then gets the time of day at which the measurement is reported. The code then delays for a small time and asks for the position and gets the time again. The velocity is then calculated by dividing the change in position byt he change in time. The return value is the velocity in rev/sec.

Parameters:
arg the argument is set to be a "this" pointer cast as a void pointer

Definition at line 249 of file PhysicalMomentumWheel.cpp.

Referenced by StartSpeedQuery().

void* RunPIDController void *  arg  )  [friend]
 

Friend function that is spawned in a new thread in order to run the PID controller. It is called internally by the CommandWheelSpeed() function. PID controller to set momentum wheel angular velocity. Runs in a separate thread created by by the CommandWheelSpeed() function. THis function is a friend to the PhyicalMomentumWheel class. Once created it will run indefinitely until either a new speed is requested or the end of the program is reached.

This controller has gain scheduling based on the magnitude of the velocity change desired. It also places limits on large changes in torque and limits the upper value of torque in order to protect the motor and its components.

Parameters:
arg the argument is set to be a "this" pointer cast as a void pointer

Definition at line 876 of file PhysicalMomentumWheel.cpp.

Referenced by StartPID().

void* RunTorqueController void *  arg  )  [friend]
 

Determine reaction wheel speed to provide the desired torque requested from controller.

Parameters:
void* arg

Definition at line 630 of file PhysicalMomentumWheel.cpp.

void* RunTorqueControllerRev void *  arg  )  [friend]
 

Friend function split in a new thread that controls the torque applied. It begins running in the StartTorqueController function. Determine reaction wheel speed to provide the desired torque requested from controller.

Parameters:
arg the argument is set to be a "this" pointer cast as a void pointer

Definition at line 396 of file PhysicalMomentumWheel.cpp.

Referenced by StartTorqueController().


Member Data Documentation

const bool Device::c_bActive = true [static, inherited]
 

a constant bool that is equal to true.

Used for setting the active state

Definition at line 50 of file Device.h.

Referenced by Device::Initialize().

const bool Device::c_bNotActive = false [static, inherited]
 

a constant bool that is equal to false.

Used for setting the active state.

Definition at line 48 of file Device.h.

Referenced by Device::Deinitialize(), and Device::Device().

double PhysicalMomentumWheel::LAST_ERR [private]
 

Member double that holds the last velocity error, used by the PID controller.

Definition at line 381 of file PhysicalMomentumWheel.h.

Referenced by PhysicalMomentumWheel(), and RunPIDController().

double PhysicalMomentumWheel::LAST_TOR [private]
 

Member double that holds the last applied wheel torque, used in PID controller.

Definition at line 378 of file PhysicalMomentumWheel.h.

Referenced by CommandSystemTorque(), PhysicalMomentumWheel(), and RunPIDController().

double PhysicalMomentumWheel::LAST_VEL [private]
 

Member double that holds the last angular velocity of the wheel, used in PID controller.

Definition at line 375 of file PhysicalMomentumWheel.h.

Referenced by PhysicalMomentumWheel(), RunPIDController(), and RunTorqueController().

double PhysicalMomentumWheel::LAST_VOLT [private]
 

Member double that holds the last voltage, used by PID controller.

Definition at line 384 of file PhysicalMomentumWheel.h.

Referenced by CommandWheelSpeed(), and PhysicalMomentumWheel().

double PhysicalMomentumWheel::m_AxialInertia [private]
 

Member double that holds the axial Inertia in kg-m^2.

Definition at line 322 of file PhysicalMomentumWheel.h.

Referenced by RunTorqueControllerRev(), and SetAxialInertia().

int PhysicalMomentumWheel::m_BiasFlag [private]
 

Member integer Bias speed set flag.

Definition at line 325 of file PhysicalMomentumWheel.h.

Referenced by PhysicalMomentumWheel(), and SetBiasSpeed().

double PhysicalMomentumWheel::m_BiasSpeed [private]
 

Momentum Wheel bias speed.

Definition at line 328 of file PhysicalMomentumWheel.h.

Referenced by SetBiasSpeed().

Vector PhysicalMomentumWheel::m_Coefficients1 [private]
 

Definition at line 415 of file PhysicalMomentumWheel.h.

Referenced by PhysicalMomentumWheel().

Vector PhysicalMomentumWheel::m_Coefficients2 [private]
 

Definition at line 416 of file PhysicalMomentumWheel.h.

Referenced by PhysicalMomentumWheel().

Vector PhysicalMomentumWheel::m_Coefficients3 [private]
 

Definition at line 417 of file PhysicalMomentumWheel.h.

Referenced by PhysicalMomentumWheel().

Vector PhysicalMomentumWheel::m_Coefficients4 [private]
 

Definition at line 418 of file PhysicalMomentumWheel.h.

Referenced by PhysicalMomentumWheel().

double PhysicalMomentumWheel::m_CurrentWheelSpeed [private]
 

Member double that holds the current angular wheel speed in rad/sec.

Definition at line 301 of file PhysicalMomentumWheel.h.

Referenced by PhysicalMomentumWheel(), QueryWheelSpeed(), RunPIDController(), RunTorqueController(), and RunTorqueControllerRev().

double PhysicalMomentumWheel::m_CurrentWheelTorque [private]
 

Member double that holds the current ouput torque in N-m.

Definition at line 316 of file PhysicalMomentumWheel.h.

Referenced by CommandSystemTorque(), and QueryWheelTorque().

int PhysicalMomentumWheel::m_DaisyChainNumber [private]
 

Member integer that holds which daisy chain the wheel is on.

Definition at line 334 of file PhysicalMomentumWheel.h.

Referenced by SetDaisyChainNumber().

string PhysicalMomentumWheel::m_DaisyChainPort [private]
 

Member string that hold which port the wheel is connected to.

Definition at line 340 of file PhysicalMomentumWheel.h.

Referenced by Initialize(), and SetDaisyChainPort().

double PhysicalMomentumWheel::m_DesiredWheelSpeed [private]
 

Member double that holds the desired angular wheel speed in rad/sec.

Definition at line 307 of file PhysicalMomentumWheel.h.

Referenced by CommandWheelSpeed(), Initialize(), RunPIDController(), RunTorqueControllerRev(), and SetWheelSpeed().

double PhysicalMomentumWheel::m_DesiredWheelTorque [private]
 

Desired wheel Torque.

Definition at line 319 of file PhysicalMomentumWheel.h.

Referenced by CommandWheelTorque(), RunTorqueController(), and RunTorqueControllerRev().

int PhysicalMomentumWheel::m_exitConditionSpeed [private]
 

Definition at line 367 of file PhysicalMomentumWheel.h.

Referenced by PhysicalMomentumWheel(), QueryWheelSpeed(), and StopSpeedQuery().

int PhysicalMomentumWheel::m_exitConditionTorque [private]
 

Definition at line 369 of file PhysicalMomentumWheel.h.

Referenced by PhysicalMomentumWheel(), RunTorqueControllerRev(), and StopTorqueController().

int PhysicalMomentumWheel::m_fd [private]
 

Member integer that holds the file descriptor for all wheels.

Definition at line 337 of file PhysicalMomentumWheel.h.

Referenced by ChangeBaud(), CommandSystemTorque(), Deinitialize(), EchoOff(), EchoOn(), EnableTorqueMode(), GetAmps(), GetVolts(), Initialize(), PhysicalMomentumWheel(), QueryWheelSpeed(), QueryWheelTorque(), Reset(), and TorqueCommand().

double PhysicalMomentumWheel::m_MaxAmps [private]
 

Member double that hold maximum current of the reaction wheel motor.

Definition at line 346 of file PhysicalMomentumWheel.h.

Referenced by PhysicalMomentumWheel().

double PhysicalMomentumWheel::m_MaxTorqueStep [private]
 

Member double that holds the largest permissable torque change in N-m.

Definition at line 387 of file PhysicalMomentumWheel.h.

Referenced by CommandSystemTorque(), PhysicalMomentumWheel(), RunPIDController(), and SetMaxTorqueStep().

double PhysicalMomentumWheel::m_MaxWheelTorque [private]
 

Member double that holds the maximum output torque in N-m.

Definition at line 310 of file PhysicalMomentumWheel.h.

Referenced by PhysicalMomentumWheel(), RunPIDController(), and SetWheelTorqueLimits().

double PhysicalMomentumWheel::m_MinVolts [private]
 

Member double that hold minimum volts of the reaction wheel motor.

Definition at line 343 of file PhysicalMomentumWheel.h.

Referenced by PhysicalMomentumWheel().

double PhysicalMomentumWheel::m_MinWheelTorque [private]
 

Member double that holds the minimum output torque in N-m.

Definition at line 313 of file PhysicalMomentumWheel.h.

Referenced by PhysicalMomentumWheel(), and SetWheelTorqueLimits().

pthread_mutex_t PhysicalMomentumWheel::m_Mutex [private]
 

Memeber mutex lock variable.

Definition at line 365 of file PhysicalMomentumWheel.h.

Referenced by ChangeBaud(), CommandSystemTorque(), CommandWheelTorque(), Deinitialize(), EchoOff(), EchoOn(), EnableTorqueMode(), GetAmps(), GetVolts(), GetWheelSpeed(), PhysicalMomentumWheel(), QueryWheelSpeed(), QueryWheelTorque(), Reset(), RunPIDController(), RunTorqueController(), RunTorqueControllerRev(), SetWheelSpeed(), Stop(), StopPID(), StopSpeedQuery(), StopTorqueController(), and TorqueCommand().

pthread_t PhysicalMomentumWheel::m_PIDThreadID [private]
 

Member pthread id for splitting off PID control.

Definition at line 356 of file PhysicalMomentumWheel.h.

Referenced by StartPID(), and StopPID().

pthread_t PhysicalMomentumWheel::m_SpeedThreadID [private]
 

Member pthread for splitting off speed queries.

Definition at line 359 of file PhysicalMomentumWheel.h.

Referenced by StartSpeedQuery(), and StopSpeedQuery().

int PhysicalMomentumWheel::m_TorqueControlFlag [private]
 

Member integer Torque Control flag, used in Torque Controller.

Definition at line 394 of file PhysicalMomentumWheel.h.

Referenced by CommandWheelTorque(), and PhysicalMomentumWheel().

double PhysicalMomentumWheel::m_TorqueControllerDeltaTime [private]
 

Delta Time to produce Desired Control Torque, used in Torque Controller [s].

Definition at line 397 of file PhysicalMomentumWheel.h.

Referenced by PhysicalMomentumWheel(), and RunTorqueControllerRev().

int PhysicalMomentumWheel::m_TorqueControllerDesiredWheelSpeedFlag [private]
 

Member integer Torque Control Wheel Speed flag, used in Torque Controller.

Definition at line 409 of file PhysicalMomentumWheel.h.

Referenced by PhysicalMomentumWheel(), and RunTorqueControllerRev().

double PhysicalMomentumWheel::m_TorqueControllerNegativeTimeGain [private]
 

Negative Time Gain.

Definition at line 403 of file PhysicalMomentumWheel.h.

Referenced by PhysicalMomentumWheel().

double PhysicalMomentumWheel::m_TorqueControllerSteadyStateGain [private]
 

Steady State Gain [rad/s].

Definition at line 406 of file PhysicalMomentumWheel.h.

Referenced by PhysicalMomentumWheel(), and RunTorqueControllerRev().

double PhysicalMomentumWheel::m_TorqueControllerTorqueGain [private]
 

Proportional Torque Gain (to tune function to supply torques closer to actual N-m).

Definition at line 400 of file PhysicalMomentumWheel.h.

Referenced by PhysicalMomentumWheel(), and RunTorqueControllerRev().

pthread_t PhysicalMomentumWheel::m_TorqueThreadID [private]
 

Member pthread for Torque Controller.

Definition at line 362 of file PhysicalMomentumWheel.h.

Referenced by StartTorqueController(), and StopTorqueController().

double PhysicalMomentumWheel::m_VelocityTime [private]
 

Memeber double holds the time of velcotiy measurement in seconds from unix epoch.

Definition at line 304 of file PhysicalMomentumWheel.h.

Referenced by QueryWheelSpeed().

int PhysicalMomentumWheel::m_WheelAddress [private]
 

Member integer that holds the address of the wheel on its daisy chain.

Definition at line 331 of file PhysicalMomentumWheel.h.

Referenced by SetWheelAddress().

string PhysicalMomentumWheel::m_WheelName [private]
 

Member double that hold maximum current of the reaction wheel motor.

Definition at line 349 of file PhysicalMomentumWheel.h.

Referenced by ChangeBaud(), CommandWheelSpeed(), Deinitialize(), EchoOff(), EchoOn(), EnableTorqueMode(), Initialize(), Reset(), and SetWheelName().

char* Device::name [protected, inherited]
 

Definition at line 56 of file Device.h.


The documentation for this class was generated from the following files:
Generated on Wed Sep 5 12:54:42 2007 for DSACSS Operational Code by  doxygen 1.3.9.1