コード例 #1
0
from vrepsim import VrepSim
import time
from evaluate import evaluate_policy
from td3.td3 import TD3


if __name__ == '__main__':

    agent = TD3()
    sim = VrepSim()
    sim.reset_sim()
    agent.load()
    evaluate_policy(agent, sim, eval_episodes=10, episode_length=50)

    sim.reset_sim()

コード例 #2
0
ファイル: dqn_main.py プロジェクト: dujinyu/Baxter-VREP
    if cons.write_to_file:
        file_episode = open(cons.file_name + "_episode.csv", "w")
        file_episode.write(
            "Episode,Reward,Avg_Reward_Last_" + str(cons.report_interval) +
            ",Avg_Reward_Last_100,Avg_Reward_All,Frames_total,Time_Elapsed,Solved,"
            "Epsilon,Distance,Memory_Usage")
        file_frame = open(cons.file_name + "_frame.csv", "w")
        file_frame.write(
            "Frame,Reward,Avg_Reward_Last_1000,Avg_Reward_Last_10000,Avg_Reward_All,"
            "Time_Elapsed,Solved,Done,Epsilon,Distance,Memory_Usage")

    memory = ExperienceReplay(cons.replay_mem_size)
    q_agent = QNetAgent(memory)

    sim = VrepSim()

    rewards_total_episode = []
    rewards_total_frame = []

    frames_total = 0

    solved_after_episode = 0
    solved_after_frame = 0
    solved = False

    boltzmann = True

    stacked_frames = 0
    episode = 0
コード例 #3
0
import keyboard  # using module keyboard
from vrepsim import VrepSim

if __name__ == '__main__':

    sim = VrepSim()
    sim.reset_sim()

    # right, left = sim.calc_distance()

    # sim.step_right([.8, 0, 0, 0, 0, 0, 0])
    # sim.step_left([-1, .3, .1, 0, 0, 0, -.1])  # yields a collision

    sim.step_right([.1, 0, 0, 0, 0, 0, 0])
    sim.step_right([-.1, 0, 0, 0, 0, 0, 0])
    sim.step_right([0, .1, 0, 0, 0, 0, 0])
    sim.step_right([0, -.1, 0, 0, 0, 0, 0])
    sim.step_right([0, 0, .1, 0, 0, 0, 0])
    sim.step_right([0, 0, -.1, 0, 0, 0, 0])
    sim.step_right([0, 0, 0, .1, 0, 0, 0])
    sim.step_right([0, 0, 0, -.1, 0, 0, 0])
    sim.step_right([0, 0, 0, 0, .1, 0, 0])
    sim.step_right([0, 0, 0, 0, -.1, 0, 0])
    sim.step_right([0, 0, 0, 0, 0, .1, 0])
    sim.step_right([0, 0, 0, 0, 0, -.1, 0])
    sim.step_right([0, 0, 0, 0, 0, 0, .1])
    sim.step_right([0, 0, 0, 0, 0, 0, -.1])

    # move left joints

    sim.step_left([.1, 0, 0, 0, 0, 0, 0])
コード例 #4
0
from vrepsim import VrepSim
import time

if __name__ == '__main__':

    sim = VrepSim()
    sim.reset_sim()
    time.sleep(3)
    dist = sim.check_suction_distance()
    print(dist)




コード例 #5
0
from vrepsim import VrepSim
import time

if __name__ == '__main__':
    # [0.231, 0.105, 1.261]
    sim = VrepSim()
    # sim.check_suction_prox()
    # time.sleep(5)
    sim.reset_sim()
    # time.sleep(1)
    print(sim.get_target_position())
    # demo both arms lifting
    # sim.step_arms([0, .45, 0, 0, -1.6, -1.5, 0], [0, .45, 0, 0, 1.6, -1.5, 0])

    # sim.check_suction_prox()
    # sim.step_arms([1., 0, 0, 0, 0, 0, 0], [-1.0, 0, 0, 0, 0, 0, 0])

    # time.sleep(1)
    # sim.check_suction_prox()
    sim.step_arms([0, -.4, 0, 0, 0, 0, 0], [0, -.4, 0, 0, 0, 0, 0])
    # sim.check_suction_prox()
    print(sim.get_target_position())
    time.sleep(1)
    sim.step_arms([.45, 0, 0, 0, 0, -1, 0], [.4, 0, 0, 0, 0, -1, 0])
    time.sleep(1)
    print(sim.get_target_position())
    '''
    # demo one arm lifting
    sim.reset_sim()
    time.sleep(1)
    print(sim.get_target_angles())