Spacecraft Control Framework 1.0
Spacecraft Control Library
Macros | Functions
sc_utility.h File Reference

Miscellaneous functions. More...

Go to the source code of this file.

Macros

#define ERROR(...)   error(__FILE__,__LINE__,__VA_ARGS__)
 Macro for calling error() with file and line information.
 

Functions

unsigned short GrayToBinary (unsigned short x)
 Converts gray code to binary. More...
 
unsigned short BinaryToGray (unsigned short x)
 Converts binary to gray code. More...
 
ml_matrix unique_numbers_in_list (const ml_matrix &u)
 Unique numbers in a list. More...
 
ml_matrix polygon_props (const ml_matrix &v, ml_matrix f, ml_matrix &n, ml_matrix &r)
 Polygon properties for a set of polygons. More...
 
double polygon (const ml_matrix &v, ml_matrix &n, ml_matrix &r)
 Polygon properties for a single polygon. More...
 
int get_naif_code (const char *s)
 Get NAIF code. More...
 
double attitude_maneuver_time (double inertia, double torque, double angle, double momentum_max)
 Attitude maneuver time. More...
 
void sc_log (const char *format,...)
 Log an informational message to stdout. More...
 
void sc_warn (const char *format,...)
 Log a message to stderr. More...
 
void sc_error (const char *file, int line, const char *format,...)
 Throw a runtime exception, halting execution of the app (if not caught) and printing an error message. More...
 

Detailed Description

Miscellaneous functions.

Function Documentation

◆ GrayToBinary()

unsigned short GrayToBinary ( unsigned short  x)

Converts gray code to binary.

Parameters
xgray code.
Returns
binary.

◆ BinaryToGray()

unsigned short BinaryToGray ( unsigned short  x)

Converts binary to gray code.

Converts binary to gray code.

Parameters
xbinary.
Returns
gray code.

◆ unique_numbers_in_list()

ml_matrix unique_numbers_in_list ( const ml_matrix &  u)

Unique numbers in a list.

Unique numbers in a list.

Parameters
urow matrix
Returns
row matrix containing unique numbers.

◆ polygon_props()

ml_matrix polygon_props ( const ml_matrix &  v,
ml_matrix  f,
ml_matrix &  n,
ml_matrix &  r 
)

Polygon properties for a set of polygons.

Polygon properties for a set of polygons.

Parameters
vnx3 matrix of vectors
fmxp matrix of faces holding indexes to v
nreturn normals 3xm
freturn position vectors 3xm
Returns
area 1xm

References polygon().

Referenced by aero_newtonian::initialize().

◆ polygon()

double polygon ( const ml_matrix &  v,
ml_matrix &  n,
ml_matrix &  r 
)

Polygon properties for a single polygon.

Polygon properties for a single polygon.

Parameters
v3xn matrix of vectors
nreturn normals 3x1
rreturn position vector 3x1
Returns
area

Referenced by polygon_props().

◆ get_naif_code()

int get_naif_code ( const char *  s)

Get NAIF code.

Get NAIF code.

The input is assumed to be lower case

Parameters
sstring
Returns
naif code

Referenced by planet_ecliptic_to_orbit().

◆ attitude_maneuver_time()

double attitude_maneuver_time ( double  inertia,
double  torque,
double  angle,
double  momentum_max 
)

Attitude maneuver time.

Attitude maneuver time.

UNFINISHED.

Parameters
inertiaaxis inertia
torquemaximum torque
angledesired angle
momentum_maxmaximum allowable momentum
Returns
Time