Ejemplo n.º 1
0
        openhubo.TIMESTEP=ha.HUBO_LOOP_PERIOD
        print 'No Dynamics mode'
    else:
        options.physics=True
        options.stop=True

    #Enable simtime if required, or if force by physics
    options.simtime = (simtimeFlag == 'simtime') or options.physics

    # Detect Load robot and scene based on openhubo version
    if oh_version=='0.8.0':
        [robot,ctrl,ind,ghost,recorder]=openhubo.load_scene(env,options)
    elif oh_version=='0.7.0':
        [robot,ctrl,ind,ghost,recorder]=openhubo.load_scene(env,options.robotfile,options.scenefile,options.stop, options.physics, options.ghost)
    else:
        [robot,ctrl,ind,ghost,recorder]=openhubo.load(env,options.robotfile,options.scenefile,options.stop, options.physics, options.ghost)

    # Setup ACH channels to interface with hubo
    s = ach.Channel(ha.HUBO_CHAN_STATE_NAME)
    s.flush()
    state = ha.HUBO_STATE()

    ts = ach.Channel(ha.HUBO_CHAN_VIRTUAL_TO_SIM_NAME)
    ts.flush()
    sim = ha.HUBO_VIRTUAL()

    fs = ach.Channel(ha.HUBO_CHAN_VIRTUAL_FROM_SIM_NAME)
    fs.flush()

    virtualHuboLog('Starting Simulation...',3)
Ejemplo n.º 2
0
    #Enable simtime if required, or if force by physics
    options.simtime = (simtimeFlag == 'simtime') or options.physics

    # Detect Load robot and scene based on openhubo version
    if oh_version == '0.8.0':
        [robot, ctrl, ind, ghost, recorder] = openhubo.load_scene(env, options)
    elif oh_version == '0.7.0':
        [robot, ctrl, ind, ghost,
         recorder] = openhubo.load_scene(env, options.robotfile,
                                         options.scenefile, options.stop,
                                         options.physics, options.ghost)
    else:
        [robot, ctrl, ind, ghost,
         recorder] = openhubo.load(env, options.robotfile, options.scenefile,
                                   options.stop, options.physics,
                                   options.ghost)

    # Setup ACH channels to interface with hubo
    s = ach.Channel(ha.HUBO_CHAN_STATE_NAME)
    s.flush()
    state = ha.HUBO_STATE()

    ts = ach.Channel(ha.HUBO_CHAN_VIRTUAL_TO_SIM_NAME)
    ts.flush()
    sim = ha.HUBO_VIRTUAL()

    fs = ach.Channel(ha.HUBO_CHAN_VIRTUAL_FROM_SIM_NAME)
    fs.flush()

    virtualHuboLog('Starting Simulation...', 3)
Ejemplo n.º 3
0
        flag = args[0]
    except:
        flag = -1

    try:
	simtimeFlag = args[1]
    except:
	simtimeFlag = -1

    (env,options)=openhubo.setup('qtcoin',True)
    env.SetDebugLevel(4)
    time.sleep(.25)

    if( 'nophysics' == flag ):
         print 'No Dynamic mode'
         [robot,ctrl,ind,ref,recorder]=openhubo.load(env,options.robotfile,options.scenefile,True, None, True)  # this will disable physics
    else:
         [robot,ctrl,ind,ref,recorder]=openhubo.load(env,options.robotfile,options.scenefile,True)
         ctrl.SendCommand('set radians ')
    time.sleep(.5)
    env.StartSimulation(openhubo.TIMESTEP)
    time.sleep(.5)
   
    #Change the pose to lift the elbows and send


    # Hubo-Ach Start and setup:
    s = ach.Channel(ha.HUBO_CHAN_STATE_NAME)
    s.flush()
    state = ha.HUBO_STATE()
    
Ejemplo n.º 4
0
            skiptemp = skiptemp/100.0
            if self.name:
                print '[%s]' % self.name,
           # print 'Elapsed: %s' % (time.time() - self.tstart)
            print 'Elapsed: ',skiptemp,' sec : ', (ha.HUBO_LOOP_PERIOD/skiptemp * 100.0),' percent'
            skipi = 0



if __name__=='__main__':

    (env,options)=openhubo.setup('qtcoin',True)
    env.SetDebugLevel(4)
    time.sleep(.25)

    [robot,ctrl,ind,ref,recorder]=openhubo.load(env,options.robotfile,options.scenefile,True)
    time.sleep(.5)
    env.StartSimulation(openhubo.TIMESTEP)
    time.sleep(.5)
   
    #Change the pose to lift the elbows and send
    ctrl.SendCommand('set radians ')


    # Hubo-Ach Start and setup:
    s = ach.Channel(ha.HUBO_CHAN_STATE_NAME)
    s.flush()
    state = ha.HUBO_STATE()
    
    ts = ach.Channel(ha.HUBO_CHAN_VIRTUAL_TO_SIM_NAME)
    ts.flush()