ericstoneking / 42

Simulation for spacecraft attitude control system analysis and design
246 stars 81 forks source link

PROTOTYPE_FSW doesn't do pointing for my spacecraft #138

Open khavernathy opened 1 month ago

khavernathy commented 1 month ago

I have a simulation with Inp_Cmd.txt:

0.0 Point SC[0].B[0] Primary Vector [0.0 0.0 0.0] at EARTH

I get these warnings at every time step:

Warning: Primary Vector not defined for SC[0]
Warning: Secondary Vector not defined for SC[0]

The flight software seems unable to point the spacecraft. It just tumbles in the visualization. How do I define the Primary and Secondary vectors for my spacecraft? I could hardcode it in ThreeAxisAttitudeCommand() or PrototypeFSW() but seems like there might be input options for this...

I noticed that the N and R vectors are culprits, but digging through the code, I don't see any documentation that describes what they are.

            if (MAGV(PV->N) == 0.0 || MAGV(PV->R) == 0.0)
               printf("Warning: Primary Vector not defined for SC[%ld]\n",S->ID);
            if (MAGV(SV->N) == 0.0 || MAGV(SV->R) == 0.0)
               printf("Warning: Secondary Vector not defined for SC[%ld]\n",S->ID);
ericstoneking commented 1 month ago

You need both a Primary and Secondary vector to define your commanded attitude. Look in Demo/Inp_Cmd.txt for examples. Also look in Inp_Cmd.txt after the "EOF" tag for templates.

Also, your Primary Vector has zero length. You'll have better luck using a vector that has a defined direction.