示例#1
0
LR_A = 1e-3  # learning rate for actor
LR_C = 1e-5  # learning rate for critic
GAMMA = 0.9  # reward discount
REPLACE_ITER_A = 1100
REPLACE_ITER_C = 1000
MEMORY_CAPACITY = 7000
BATCH_SIZE = 200
VAR_MIN = 0.01
RENDER = True
LOAD = True
MODE = ['easy', 'hard']
n_model = 0

#env = ArmEnv(mode=MODE[n_model])
mar = marker()
env = Env()
speek = speek()
STATE_DIM = env.state_dim
ACTION_DIM = env.action_dim
ACTION_BOUND = env.action_bound


# Parameters  
parser = argparse.ArgumentParser()
parser.add_argument('--load', type=str, default= 'True',
                     help='Load checkpoints or not' )
parser.add_argument('--vrep', type=bool, default=True,
                     help='Use vrep or not' )
parser.add_argument('--target_x', type=float, default= 33,
                     help='target position_x' )
parser.add_argument('--target_y', type=float, default= 5.4,
示例#2
0
from std_msgs.msg import Int32
from time import sleep

os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0,3"

rospy.init_node('pub')
pub = rospy.Publisher('car', Int32, queue_size=20)
scores = []
print()
print("run")
print()
if __name__ == '__main__':
    global_step = 0
    agent = dqn(365, 5, 100000000, 0.001)  # state size 365, output size 5
    env = Env()
    #r = rospy.Duration(1,0)
    for e in range(1, 3000):
        done = False
        state = env.reset()
        score = 0
        print()
        print("run")
        print()
        for t in range(1, 3000):
            print()
            print("run")
            print()
            action = agent.get_action(state)
            pub.publish(action)  # robot run
            rospy.sleep(10.)
示例#3
0

###global setting
xscale = 'liner'#ACCEPT [integer 1 to 10 | 'liner']  example xscale = 10 #means xscale use log10
yscale = 'liner'



####solve data file1
workpath = r"F:\Users\JianyingLi\Desktop\S1P0.05E1"
indexname = "eRHo"
extname = ".dat"
timeCoe = 10e-7
lengthCoe = 0.0003125

instance = Env()
print instance.get_workingPath()
fileReader = filereader(instance.get_fileList(workpath), workpath)
fileReader.select_files(extname, indexname)
fileReader.read_data()

# print fileReader.data
dp = DataProcess()

x0,y0 =  dp.data1D(fileReader.data, extname, indexname,timeCoe)
#####################################################################


####solve data file2
workpath = r"F:\Users\JianyingLi\Desktop\S1P0.05E0.4"
indexname = "eRHo"