コード例 #1
0
def get_session(n_epucks=1,
                use_proximeters=[2, 3],
                old_simulator=None,
                old_epuck=None):
    if old_simulator is not None:
        old_simulator.stop()
        old_simulator.io.close()
        del old_simulator
    if old_epuck is not None:
        old_epuck.stop()
        old_epuck.io.close()
        del old_epuck
    sleep(0.1)
    close_all_connections()
    sleep(0.1)
    close_all_connections()
    sleep(0.1)
    simulator = Simulator()
    simulator.io.restart_simulation()
    epucks = [
        simulator.get_epuck(use_proximeters=use_proximeters)
        for _ in range(n_epucks)
    ]
    if n_epucks == 1:
        return simulator, epucks[0]
    else:
        return [simulator] + epucks
コード例 #2
0
def close_session(simulator, *epucks):
    simulator.close()
    for e in epucks:
        e.close()
        del e
    del simulator
    sleep(0.1)
    close_all_connections()
コード例 #3
0
def close_session(simulator, *epucks):
    simulator.close()
    for e in epucks:
        e.close()
        del e
    del simulator
    sleep(0.1)
    close_all_connections()
コード例 #4
0
def close_session(simulator, *epucks):
    if len(epucks) == 0:
        epucks = simulator.robots
    simulator.close()
    for e in epucks:
        e.close()
        del e
    del simulator
    sleep(0.1)
    close_all_connections()
コード例 #5
0
ファイル: test_run.py プロジェクト: sfosset/luxo_alpha
def main():
    x_home = [0.060175, -0.0049936, 0.31573]
    q_home = [0, 0, 0, 0, 0]

    robot = from_vrep(scene='../model_1/luxo_1_kinematic.ttt',
                      config='../model_1/config_luxo_1.json')
    robot.stop_simulation()
    robot._controllers[0].io.call_remote_api('simxCloseScene')
    close_all_connections()

    # robot = {
    #     "motors":{
    #         "foot":{
    #             "id":12,
    #             "orientation":"direct",
    #             "type":"AX-12",
    #             "offset":0.0
    #         },
    #         "body_bottom":{
    #             "id":13,
    #             "orientation":"direct",
    #             "type":"AX-12",
    #             "angle_limit":[-90.0, 90.0],
    #             "offset":0.0
    #         },
    #         "body_middle":{
    #             "id":14,
    #             "orientation":"direct",
    #             "type":"AX-12",
    #             "angle_limit":[-130.0, 130.0],
    #             "offset":0.0
    #         },
    #         "body_top":{
    #             "id":15,
    #             "orientation":"direct",
    #             "type":"AX-12",
    #             "angle_limit":[-130.0, 130.0],
    #             "offset":0.0
    #         },
    #         "head":{
    #             "id":16,
    #             "orientation":"direct",
    #             "type":"AX-12",
    #             "offset":0.0
    #         }
    #     }
    # }

    f = VrepDirectFunctionWoPypot(robot)
    g = PolynomialModel(3, 5, 4, q_home)
    trainer = GoalBabblingTrainer(g, f, q_home, x_home,
                                  '../model_1/luxo_1_data_20_5.json')
    trainer.train(200, 4, 0.05)
コード例 #6
0
ファイル: test_run.py プロジェクト: sfosset/luxo_alpha
def main():
    x_home = [0.060175, -0.0049936, 0.31573]
    q_home = [0, 0, 0, 0, 0]

    robot = from_vrep(scene = '../model_1/luxo_1_kinematic.ttt',
        config = '../model_1/config_luxo_1.json'
    )
    robot.stop_simulation()
    robot._controllers[0].io.call_remote_api('simxCloseScene')
    close_all_connections()

    # robot = {
    #     "motors":{
    #         "foot":{
    #             "id":12,
    #             "orientation":"direct",
    #             "type":"AX-12",
    #             "offset":0.0
    #         },
    #         "body_bottom":{
    #             "id":13,
    #             "orientation":"direct",
    #             "type":"AX-12",
    #             "angle_limit":[-90.0, 90.0],
    #             "offset":0.0
    #         },
    #         "body_middle":{
    #             "id":14,
    #             "orientation":"direct",
    #             "type":"AX-12",
    #             "angle_limit":[-130.0, 130.0],
    #             "offset":0.0
    #         },
    #         "body_top":{
    #             "id":15,
    #             "orientation":"direct",
    #             "type":"AX-12",
    #             "angle_limit":[-130.0, 130.0],
    #             "offset":0.0
    #         },
    #         "head":{
    #             "id":16,
    #             "orientation":"direct",
    #             "type":"AX-12",
    #             "offset":0.0
    #         }
    #     }
    # }

    f = VrepDirectFunctionWoPypot(robot)
    g = PolynomialModel(3,5,4,q_home)
    trainer = GoalBabblingTrainer(g,f,q_home,x_home, '../model_1/luxo_1_data_20_5.json')
    trainer.train(200,4,0.05)
コード例 #7
0
    def __init__(self):

        vrep.close_all_connections()

        self.poppy = PoppyHumanoid(simulator='vrep')

        self.waitTime()

        #self.vrep_io = VrepIO(vrep_port=port, start=True)

        #self.vrep_io.load_scene("thing.ttt")

        #self.vrep_io.start_simulation()

        self.poppy_head_pos = []

        self.next_update = .2
        self.last_update = time()
コード例 #8
0
def get_session(n_epucks=1, use_proximeters=[2, 3], old_simulator=None, old_epuck=None):
    if old_simulator is not None:
        old_simulator.stop()
        old_simulator.io.close()
        del old_simulator
    if old_epuck is not None:
        old_epuck.stop()
        old_epuck.io.close()
        del old_epuck
    sleep(0.1)
    close_all_connections()
    sleep(0.1)
    close_all_connections()
    sleep(0.1)
    simulator = Simulator()
    simulator.io.restart_simulation()
    epucks = [simulator.get_epuck(use_proximeters=use_proximeters) for _ in range(n_epucks)]
    if n_epucks == 1:
        return simulator, epucks[0]
    else:
        return [simulator] + epucks
コード例 #9
0
def close():
    close_all_connections()
コード例 #10
0
def close():
    close_all_connections()
コード例 #11
0
'''

# Import libraries
from pypot.vrep import from_vrep, close_all_connections
from pypot.robot import from_config
import time
import numpy as np
import itertools
import random
import pypot.dynamixel

# if in the vrep env
vrep = False

if vrep:
    close_all_connections()
    poppy = from_vrep('poppy.json', scene='experiment.ttt')

#initial motor angle
if vrep:
    arm_theta1 = 0
    arm_theta2 = 0
    arm_theta3 = -10
    for m in poppy.motors:
        if m.id == 41:
            motor_41 = m
        if m.id == 42:
            motor_42 = m
        if m.id == 44:
            motor_44 = m
else: