mirror of
https://github.com/nasa/trick.git
synced 2024-12-22 06:27:49 +00:00
72 lines
1.7 KiB
Plaintext
72 lines
1.7 KiB
Plaintext
|
/************************TRICK HEADER*************************
|
||
|
PURPOSE:
|
||
|
(blah blah blah)
|
||
|
LIBRARY DEPENDENCIES:
|
||
|
(
|
||
|
)
|
||
|
*************************************************************/
|
||
|
|
||
|
#include "sim_objects/default_trick_sys.sm"
|
||
|
|
||
|
##include "Ball++/L1/include/Ball.hh"
|
||
|
|
||
|
/**
|
||
|
This class is the base ball class
|
||
|
*/
|
||
|
class ballSimObject : public Trick::SimObject {
|
||
|
|
||
|
public:
|
||
|
/** The actual ball object */
|
||
|
Ball obj ;
|
||
|
|
||
|
/** Constructor to add the jobs */
|
||
|
ballSimObject() {
|
||
|
("default_data") obj.force.default_data() ;
|
||
|
("default_data") obj.state.default_data() ;
|
||
|
|
||
|
("initialization") obj.state_init() ;
|
||
|
|
||
|
("derivative") obj.force_field() ;
|
||
|
("derivative") obj.state_deriv() ;
|
||
|
("integration") trick_ret = obj.state_integ() ;
|
||
|
|
||
|
{BLUE} (10.0, "scheduled") trick_ret = obj.state_print() ;
|
||
|
|
||
|
//C1 (10.0, "scheduled") obj.state_print() ;
|
||
|
//C2 (10.0, "scheduled") obj.state_print() ;
|
||
|
|
||
|
("freeze") obj.state_print() ;
|
||
|
|
||
|
("shutdown") obj.shutdown() ;
|
||
|
}
|
||
|
} ;
|
||
|
|
||
|
class DerivedBallSimObject : public ballSimObject {
|
||
|
public:
|
||
|
int print_me() {
|
||
|
message_publish( MSG_NORMAL , "In derived ball job\n" ) ;
|
||
|
}
|
||
|
DerivedBallSimObject() {
|
||
|
(10.0, "scheduled") print_me() ;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Instantiations
|
||
|
DerivedBallSimObject ball ;
|
||
|
|
||
|
IntegLoop my_integ_loop (0.01) ball;
|
||
|
|
||
|
// Connect objects
|
||
|
void create_connections() {
|
||
|
|
||
|
// Set the default termination time
|
||
|
trick_sys.sched.set_terminate_time(300.0) ;
|
||
|
trick_sys.sched.set_freeze_frame(0.10) ;
|
||
|
|
||
|
ball.obj.state.add_external_force( ball.obj.force.output.force ) ;
|
||
|
|
||
|
my_integ_loop.getIntegrator( Runge_Kutta_2, 4);
|
||
|
|
||
|
}
|
||
|
|