osim-rl
osim-rl copied to clipboard
Observations that are not part of observation_space
I found some observations fall outside the specified limits.
Here is a script to test this:
from osim.env import L2M2019Env
def main():
env = L2M2019Env(visualize=False)
print("ENV reports observation space to be: ")
print(env.observation_space)
print("ENV reports action space to be:")
print(env.action_space)
print("HIGH and LOW")
print(env.observation_space.high)
print(env.observation_space.low)
observation = env.reset()
print(" ***************** ")
print("type(reset()): ")
print(" ***************** ")
print(type(observation))
print(" ***************** ")
print("type(reset(project=False)): ")
print(" ***************** ")
observation = env.reset(project=False)
print(type(observation))
print(" ***************** ")
print("type and len of reset(obs_as_dict=False)")
print(" ***************** ")
observation = env.reset(obs_as_dict=False)
print(type(observation))
print(len(observation))
print("Observation space contains observation?")
print(env.observation_space.contains(observation))
while True:
if(not env.observation_space.contains(observation)):
print("Found observation that is not part of obs space!")
print(observation)
raise False
observation, reward, done, info = env.step(env.action_space.sample(), obs_as_dict=False)
if done:
observation = env.reset(obs_as_dict=False)
if __name__ == '__main__':
main()
Here is the observation in question (from output):
Found observation that is not part of obs space!
[1.1504510679393012, 1.2227776638989352, 1.3003199031803956, 1.382258724905569, 1.4669538416330874, 1.5516434982124165, 1.6322134321664385, 1.7032198740082427, 1.7584013263341838, 1.7918074685507301, 1.7993281694719134, 1.0601248878141536, 1.1344633643702662, 1.2159341870662428, 1.3042272900849088, 1.3981342733220175, 1.4950309867968712, 1.5903142582122929, 1.6770678142372215, 1.7464591010685062, 1.7893684797321125, 1.799126521764521, 0.9556321121113065, 1.0301123610877279, 1.1137132670189314, 1.2069249721605722, 1.3094265779521868, 1.4193240878252489, 1.5320666815496, 1.639315910757814, 0.9379782168383592, 1.060986639166542, 1.0911242601599567, 0.8357248081704858, 0.9076703448229266, 0.9904851308087498, 1.0857298017889856, 1.194531664334668, 1.3166846232132183, 0.7899362890101835, 1.0992232073928083, 1.3883359731850682, 1.5688418956375867, 1.609066912480273, 0.6997634652062796, 0.7656727815057409, 0.8434829573004097, 0.9359178247864, 1.0460078795448173, 0.6569249398010731, 1.0175346107162853, 1.3879404329779772, 1.6440326572874273, 1.7649874989555976, 1.7875839344542566, 0.5480934431981433, 0.6038292941015866, 0.6712058353541114, 0.7538079063791826, 0.4303004708711602, 0.7207530987644583, 1.0823469941243367, 1.3416087816728652, 1.4364720754528624, 1.4370109894970018, 1.4315987048200778, 0.3823972380706348, 0.42366459787246463, 0.4745509500757817, 0.5386660609060333, 0.372404322651088, 0.6366472809373023, 0.8826116617669334, 0.9798508403310632, 0.9493936475754707, 0.9242641425257591, 0.9284940444990787, 0.20588176247131415, 0.2289758296947896, 0.25784470912424995, 0.2949293393153032, 0.23321952855511982, 0.38897732846281524, 0.5023587742572231, 0.5114624947272297, 0.4929467285791764, 0.6601245056132621, 0.8131388751183635, 0.023151838293851014, 0.025788830828721684, 0.0291036564407327, 0.03339616067111792, 0.0278169358713518, 0.04566504143382299, 0.05712007653834568, 0.056215455413068646, 0.058684813167923386, 0.10842163619103418, 0.10842163619103375, -0.16029493270424647, -0.17838580871164147, -0.20105067361341303, -0.23025859344996627, -0.18593311542341068, -0.30826282530676535, -0.3931625194796129, -0.3947735221490758, -0.3886507441161189, -0.6161448845579254, -0.7536041310706902, -0.3388536889703983, -0.37585615733896427, -0.4216713084251036, -0.4797309536368035, -0.3455681197874464, -0.5878620078339224, -0.7987361900884529, -0.8643470232056601, -0.8249989880923481, -0.8273344863980331, -0.8489779747093587, 1.3843635144994693, 1.3209143744656058, 1.2446558357204316, 1.1529791053711382, 1.0430946392911467, 0.91236092334949, 0.7588671239785363, 0.5822731839809786, 0.3847398803687797, 0.17154007008808658, -0.04917457213696487, 1.4546942023109286, 1.3974952146256878, 1.327216656286213, 1.240560831155722, 1.1336756827957084, 1.002438201844469, 0.843149192092767, 0.6537916689967757, 0.43575292115485137, 0.19534698293341715, -0.056069231165562686, 1.5253744675658119, 1.4760990900120041, 1.4140872529182982, 1.335414584155498, 1.2350716727997715, 1.1070316769266475, 0.9448659604862464, 0.7433998552167465, 0.27223609101810764, 0.13473731860317728, -0.03955561738162653, 1.5942283540974942, 1.5543920178413906, 1.5029767814729453, 1.4356847834769475, 1.3465118279843842, 1.2273310893943268, 0.5822186299766187, 0.5957268903067919, 0.4815584649081528, 0.23809959730064129, -0.06971232331362306, 1.6584122203971183, 1.629031979938166, 1.5901372584603364, 1.5375492919731366, 1.464877986704065, 0.7607635774839397, 0.9317453056180417, 0.9345146912357551, 0.7084657753042116, 0.33279370781523526, -0.09621790256871941, 1.7145243006511175, 1.6956975507397478, 1.6701744599252466, 1.6345560988477066, 0.7954009971255925, 1.1017125418066325, 1.3081644760289017, 1.1923095182614634, 0.8170590333753898, 0.35763612052102883, -0.10170880521067985, 1.7589122639620065, 1.7494308527374165, 1.7363183451723858, 1.7175094977402534, 1.0122071833537885, 1.4309387865754484, 1.5685771686741135, 1.2804525222619845, 0.7940410618444831, 0.33823440549461753, -0.0969966578168823, 1.7881869868337892, 1.785376730389299, 1.7814365287533067, 1.7756735862232784, 1.1969754338948837, 1.6508669715272843, 1.6858380141329474, 1.2620684951902015, 0.7785065147443747, 0.45615575185637663, -0.16040134101281905, 1.7998511028370143, 1.799815250575594, 1.7997647005044242, 1.7996901667932814, 1.27786701161312, 1.7347132314053493, 1.7157210380832586, 1.2415977353546952, 0.8295528011326972, 0.670593442895765, -0.1914323243659598, 1.7928484416005002, 1.7911388844113385, 1.7887366006876453, 1.7852117465842654, 1.228869604410904, 1.6847585768256204, 1.6990364334589865, 1.2544284101644618, 0.7904064905112526, 0.548275550017592, -0.19143232436596033, 1.7678173484472748, 1.7603216038526563, 1.749912371420655, 1.7348942942216172, 1.065329897017029, 1.4986261418337659, 1.610035061658519, 1.281112871210818, 0.7826107320840571, 0.3433986225636837, -0.10059347577181273, 0.9403244764799331, -0.0025113214125211617, 7.656267356148189e-05, 0.24368472516356043, 0.005539130088757697, 0.07055478650417238, -0.5652994575585393, 0.028066415516582253, -0.028723968282882123, -0.3993167223984701, 0.012234828654710038, 0.6787164236177272, 9.515453968671973e-05, 0.014943440201371765, 0.02267642114177453, 0.011145569595141819, 0.03342740271412552, 3.4744026151589136, 5.32564185467855, 3.50063536069065, 0.13680435149122414, 0.9081785446807152, -1.0467195548680255, 0.1506449135774646, 0.6276056315550748, -0.47104209919981016, 0.4728880294366248, 1.095421868433398, -0.6370922195470278, 0.046099867699837885, 1.0194451910393103, -1.0670640516844656, 0.06767917230335536, 0.90922849805115, -1.5769830904998903, 0.07414803489773446, 0.769791700657627, -3.0813738971480995, 0.18501804370897895, 0.7741680594809619, -2.701465251357727, 0.18681048044909498, 1.2179277148833307, 0.008154137262781021, 0.0793562276539892, 1.088804774117628, -4.595917949109925, 0.06629844456360318, 0.9915928882788331, -4.334347848133845, 0.10055449066791909, 0.9124862137736545, -1.1940656224579078, -0.37674622023823184, 0.06225759765957538, 0.6604157848331215, -0.00013411617844454038, 0.015670498712191533, 0.024009629197252483, 0.011566402200597192, -0.04931889831849487, 3.686824377632942, 5.7101168312577935, 3.6019489690829984, 0.280188201142093, 0.9040035900494294, -1.1996823114022397, 0.3374925362207827, 0.6223359157456795, -0.601364399648568, 0.37132818693362374, 1.0988302943850352, -0.43480334383767516, 0.1016261882397656, 1.0172904355595944, -1.2008027644178454, 0.0927085781645083, 0.89697908543947, -3.0210877084029404, 0.054830081818547434, 0.780031358681687, -1.8746241065727562, 0.18098043636261646, 0.7737335690626042, -2.820363861176808, 0.4794248775855231, 1.208770004791147, -0.3965607279021797, 0.08490103936253944, 1.080879577576037, -5.66581538002696, 0.06081828194056031, 0.9978357576085607, -3.4930921052683632, 0.10532297457155616, 0.911396099740937, -1.2944613953031374]
Quick hacky fix is:
spaces.Box(low=-np.inf, high=np.inf, shape=(339,))
Thanks for finding this. The observation space is updated: https://github.com/stanfordnmbl/osim-rl/commit/5d9ec97501a671dfcfe1c2f7e2edf19d3615d891
See the error I'm getting: https://github.com/stanfordnmbl/osim-rl/commit/5d9ec97501a671dfcfe1c2f7e2edf19d3615d891#commitcomment-34541672
@drozzy The environment is updated again: https://github.com/stanfordnmbl/osim-rl/commit/12fc66c84750c6691db9164b9e5ecb7b30ecf6b5
If you see this problem again:
- please report to us as you are doing
- and consider using env.get_observation_clipped() for your training