Skip to content

Commit

Permalink
Add defaultControlPeriod parameter for first module call
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianHammerl authored and patkenneally committed Sep 9, 2023
1 parent 1716de1 commit dcce180
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ void Reset_thrFiringRemainder(thrFiringRemainderConfig *configData, uint64_t cal
configData->pulseRemainder[i] = 0.0;
}

/*! - use default value of 2 seconds for control period of first call if not specified.
* Control period (FSW rate) is computed dynamically for any subsequent calls.
*/
configData->defaultControlPeriod = (0.0 == configData->defaultControlPeriod) ?
2.0 : configData->defaultControlPeriod;
}

/*! This method maps the input thruster command forces into thruster on times using a remainder tracking logic.
Expand All @@ -99,7 +104,7 @@ void Update_thrFiringRemainder(thrFiringRemainderConfig *configData, uint64_t ca
/*! - The first time update() is called there is no information on the time step.
* Pick 2 seconds for the control period */
if(configData->prevCallTime == 0) {
controlPeriod = 2.;
controlPeriod = configData->defaultControlPeriod;
} else {
/*! - compute control time period Delta_t */
controlPeriod = ((double)(callTime - configData->prevCallTime)) * NANO2SEC;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ typedef struct {
int numThrusters; //!< [-] The number of thrusters available on vehicle
double maxThrust[MAX_EFF_CNT]; //!< [N] Max thrust
int baseThrustState; //!< [-] Indicates on-pulsing (0) or off-pusling (1)
double defaultControlPeriod; //!< [s] Default control period used for first call

uint64_t prevCallTime; //!< callTime from previous function call

Expand Down

0 comments on commit dcce180

Please sign in to comment.