Exemple #1
0
def main():

    # Data recording test
    drg0 = trick.DRAscii("Ball")
    for param in [ 'position' , 'velocity' , 'acceleration' , 'external_force' ] :
        for index in range(0,2) :
            var = "ball.obj.state.output." + param + "[" + str(index) + "]"
            drg0.add_variable(var)
    drg0.set_cycle(0.01)
    drg0.freq = trick.DR_Always
    drg0.thisown = 0
    trick.add_data_record_group(drg0, trick.DR_Buffer)

    my_integ_loop.getIntegrator(trick.Runge_Kutta_2, 4);

    trick_message.mpublisher.sim_name = "ball_sim"

    trick.checkpoint_pre_init(False)
    trick.checkpoint_post_init(False)
    trick.checkpoint_end(False)

    trick.exec_set_freeze_frame(0.10)
    trick.stop(300.0)

    trick_utest.unit_tests.enable() ;
    trick_utest.unit_tests.set_file_name( os.getenv("TRICK_HOME") + "/trick_test/SIM_Ball++_L1.xml" ) ;
Exemple #2
0
def main():

    # Data recording HDF5 test
    drg0 = trick.DRAscii("Ball")
    for param in ['position']:
        for index in range(0, 2):
            var = "ball.obj.state.output." + param + "[" + str(index) + "]"
            drg0.add_variable(var)
    drg0.set_cycle(0.01)
    drg0.freq = trick.DR_Always
    drg0.thisown = 0
    trick.add_data_record_group(drg0, trick.DR_Buffer)

    trick.sim_control_panel_set_enabled(True)

    trick.real_time_enable()
    trick.itimer_enable()

    #trick.TMM_hexfloat_checkpoint(True)
    #trick.exec_set_rt_nap(False)

    #trick_real_time.gtod_clock.set_clock_ID(trick.TRICK_CLOCK_MONOTONIC)
    #trick.real_time_change_clock(trick_tpro.tpro_cte)
    #trick.real_time_change_clock(trick_bc635.bc635)
    trick.message_publish(
        trick.MSG_INFO,
        "Current clock is = " + trick.real_time_clock_get_name() + "\n")
    trick_real_time.rt_sync.align_sim_to_wall_clock = True
    #real_time.rt_sync.align_tic_mult = 60.0

    #trick.echo_jobs_on() ;
    #trick.debug_pause_on() ;

    if hasattr(top.cvar, 'trick_jsonvs'):
        trick_jsonvs.vs.set_port(50000)
        trick.message_publish(
            trick.MSG_INFO,
            "JSON listen port = " + str(trick_jsonvs.vs.get_port()) + "\n")

    # set the software frame and freeze_frame
    trick.exec_set_software_frame(0.1)
    trick.exec_set_freeze_frame(0.1)
    #trick.exec_set_freeze_command(True)

    #trick.exec_set_enable_freeze(True)
    #trick.exec_set_stack_trace(False)
    #trick.freeze()
    #trick.freeze(5.0)

    #trick.add_read(1.0,"""trick.checkpoint("chkpnt_1.0")""")

    my_integ_loop.getIntegrator(trick.Runge_Kutta_2, 4)

    trick.exec_set_terminate_time(3000.0)

    # Turn on frame logging
    #real_time.frame_log.tl_max_samples = 10000;
    trick.frame_log_on()
Exemple #3
0
def main():

    # Data recording HDF5 test
    drg0 = trick.DRAscii("Ball")
    for param in [ 'position' ] :
        for index in range(0,2) :
            var = "ball.obj.state.output." + param + "[" + str(index) + "]"
            drg0.add_variable(var)
    drg0.set_cycle(0.01)
    drg0.freq = trick.DR_Always
    drg0.thisown = 0
    trick.add_data_record_group(drg0, trick.DR_Buffer)

    trick.sim_control_panel_set_enabled(True)

    trick.real_time_enable()
    trick.itimer_enable()

    #trick.TMM_hexfloat_checkpoint(True)
    #trick.exec_set_rt_nap(False)

    #trick_real_time.gtod_clock.set_clock_ID(trick.TRICK_CLOCK_MONOTONIC)
    #trick.real_time_change_clock(trick_tpro.tpro_cte)
    #trick.real_time_change_clock(trick_bc635.bc635)
    trick.message_publish(trick.MSG_INFO, "Current clock is = " + trick.real_time_clock_get_name() + "\n")
    trick_real_time.rt_sync.align_sim_to_wall_clock = True
    #real_time.rt_sync.align_tic_mult = 60.0

    #trick.echo_jobs_on() ;
    #trick.debug_pause_on() ;

    if hasattr(top.cvar, 'trick_jsonvs'):
        trick_jsonvs.vs.set_port(50000)
        trick.message_publish(trick.MSG_INFO, "JSON listen port = " + str(trick_jsonvs.vs.get_port()) + "\n")

    # set the software frame and freeze_frame
    trick.exec_set_software_frame(0.1)
    trick.exec_set_freeze_frame(0.1)
    #trick.exec_set_freeze_command(True)

    #trick.exec_set_enable_freeze(True)
    #trick.exec_set_stack_trace(False)
    #trick.freeze()
    #trick.freeze(5.0)

    #trick.add_read(1.0,"""trick.checkpoint("chkpnt_1.0")""")

    my_integ_loop.getIntegrator(trick.Runge_Kutta_2, 4)

    trick.exec_set_terminate_time(3000.0)

    # Turn on frame logging
    #real_time.frame_log.tl_max_samples = 10000;
    trick.frame_log_on()
Exemple #4
0
def main():

    # Data recording HDF5 test
    drg0 = trick.DRAscii("Ball")
    for param in [ 'position' , 'velocity' , 'acceleration' , 'external_force' ] :
        for index in range(0,2) :
            var = "ball.obj.state.output." + param + "[" + str(index) + "]"
            drg0.add_variable(var)
    drg0.set_cycle(0.01)
    drg0.freq = trick.DR_Always
    drg0.thisown = 0
    trick.add_data_record_group(drg0, trick.DR_Buffer)

    my_integ_loop.getIntegrator( trick.Runge_Kutta_2, 4 );

    #print trick.ref_attributes("ball.obj.state.output.velocity").attr.units

    #message.mpublisher.sim_name = "ball_sim"

    trick.stop(300.0)

    #trick.exec_set_time(-10.0)
    trick.checkpoint_pre_init(True)