Closed hayday100 closed 2 years ago
The problem above has a workaround to change the floor object size of x and y from zero to something positive. However, it runs into the following problem next:
`$ python rover.py
Creating window glfw
Creating window glfw
MuJoCo session created
Build finished in 0:00:00
Optimization finished in 0:00:00
Construction finished in 0:00:00
/home/user/nengo-loihi/venv/lib/python3.6/site-packages/nengo/node.py:63: UserWarning: 'Node.size_out' is being overwritten with 'Node.size_in' since 'Node.output=None'
"'Node.size_out' is being overwritten with "
['LoihiBlock(<Ensemble "accel">[0:1024:1]): 100.0% compartments, 0.1% in-axons, 25.0% out-axons, 3.5% synapses', 'LoihiBlock(<Ensemble "accel">[1024:2048:1]): 100.0% compartments, 0.1% in-axons, 25.0% out-axons, 3.5% synapses', 'LoihiBlock(<Ensemble "accel">[2048:3072:1]): 100.0% compartments, 0.1% in-axons, 25.0% out-axons, 3.5% synapses', 'LoihiBlock(<Ensemble "accel">[3072:4096:1]): 100.0% compartments, 0.1% in-axons, 25.0% out-axons, 3.5% synapses', 'LoihiBlock(<Ensemble "steer">[0:1024:1]): 100.0% compartments, 0.3% in-axons, 25.0% out-axons, 10.5% synapses', 'LoihiBlock(<Ensemble "steer">[1024:2048:1]): 100.0% compartments, 0.3% in-axons, 25.0% out-axons, 10.5% synapses', 'LoihiBlock(<Ensemble "steer">[2048:3072:1]): 100.0% compartments, 0.3% in-axons, 25.0% out-axons, 10.5% synapses', 'LoihiBlock(<Ensemble "steer">[3072:4096:1]): 100.0% compartments, 0.3% in-axons, 25.0% out-axons, 10.5% synapses', 'LoihiBlock(<Ensemble "conv2d_1.0">[0:960:1]): 93.8% compartments, 53.7% in-axons, 93.8% out-axons, 74.3% synapses', 'LoihiBlock(<Ensemble "conv2d_1.0">[960:1920:1]): 93.8% compartments, 53.7% in-axons, 93.8% out-axons, 72.2% synapses', 'LoihiBlock(<Ensemble "dense.0">[0:50:1]): 4.9% compartments, 46.9% in-axons, 1.2% out-axons, 82.0% synapses', 'LoihiBlock(<Ensemble "dense.0">[50:100:1]): 4.9% compartments, 46.9% in-axons, 1.2% out-axons, 82.0% synapses', 'LoihiBlock(<Ensemble "dense.0">[100:150:1]): 4.9% compartments, 46.9% in-axons, 1.2% out-axons, 82.0% synapses', 'LoihiBlock(<Ensemble "dense.0">[150:200:1]): 4.9% compartments, 46.9% in-axons, 1.2% out-axons, 82.0% synapses', 'LoihiBlock(<Ensemble "dense_1.0">): 9.8% compartments, 4.9% in-axons, 4.9% out-axons, 17.1% synapses', 'LoihiBlock(<Connection from <Ensemble "accel"> to <Node (unlabeled) at 0x7fe5e417acf8> computing \'accel_function\'>): 0.2% compartments, 100.0% in-axons, 0.0% out-axons, 25.0% synapses', 'LoihiBlock(<Connection from <Ensemble "steer"> to <Node (unlabeled) at 0x7fe5e40b3320> computing \'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "rover.py", line 346, in
Hello @hayday100 !
I haven't had the chance to look over this issue yet, but I wanted to let you know that I'll be able to look into it this weekend, and you're not just sending messages off into a dark cyber void!
Just looking at this line, though,
AttributeError: 'MjViewer' object has no attribute 'exit'
which mujoco_py install are you using? I believe this may require this one https://github.com/studywolf/mujoco-py and I don't recall if that was well documented.
Hello @hayday100 !
I haven't had the chance to look over this issue yet, but I wanted to let you know that I'll be able to look into it this weekend, and you're not just sending messages off into a dark cyber void!
Just looking at this line, though,
AttributeError: 'MjViewer' object has no attribute 'exit'
which mujoco_py install are you using? I believe this may require this one https://github.com/studywolf/mujoco-py and I don't recall if that was well documented.
Hello @studywolf:
Good to hear from you!
That's exactly the problem. I installed the mujoco-py from openai github which wasn't compatible. Now the rover is working perfectly!
I also downloaded the h5 data file for the arm simulation. Could you give some insight into the following error?
python plot_full.py
Traceback (most recent call last):
File "plot_full.py", line 9, in
Oh great, glad the first issue is resolved!
Hmmmm, sorry about that. @p3jawors could you double check the name of the keys in the h5 file?
Yes, it seems all keys/values are there:
>>> import h5py
>>> f = h5py.File('abr_neurorobotics2020_adaptation_data.h5', 'r')
>>> list(f.keys())
['weighted_tests']
>>> dset = f['weighted_tests']
>>> list(dset.keys())
['nengo_cpu1k', 'nengo_gpu1k', 'nengo_loihi1k', 'pd', 'pd_no_weight', 'pid']
>>> list(dset['pd_no_weight'].keys())
['proc_data', 'session000', 'session001', 'session002', 'session003', 'session004', 'statistical_error_0']
>>> list(dset['pd_no_weight']['statistical_error_0'].values())
[<HDF5 dataset "datestamp": shape (), type "|O">, <HDF5 dataset "lower_bound": shape (50,), type "<f8">, <HDF5 dataset "mean": shape (50,), type "<f8">, <HDF5 dataset "time_derivative": shape (), type "<i8">, <HDF5 dataset "timestamp": shape (), type "|O">, <HDF5 dataset "upper_bound": shape (50,), type "<f8">]
>>>
Hi @hayday100 ,
Sorry for the delay in responding. I won't be able to test it out this week, but I believe the issue is with the import of DataHandler
in the plotting script here. Instead of importing from abr_analyze
there is a stripped down version of the data handler at the root of this repo. I suspect that if you change it to import that version it should work. Let me know if you still have issues and I'll dig into this as soon as I get a moment.
Cheers,
Pawel
That is indeed the problem. Just to document my changes. The beginning of plot_performance.py should be:
#from abr_analyze import DataHandler
import sys
sys.path.append("../")
from data_handler import DataHandler
Then I touched two files data/Nengo_gpu_GPU_power.log and figures/adaptive_arm_results.pdf. It works then.
Thanks!
Ah excellent, glad it's working! Thanks for posting the steps taken, we'll update the README accordingly.
@studywolf Thanks! Just curios, is it possible to release the arm simulation code in addition to the results plot?
oh, so this was run not with an arm simulation but with the actual Jaco2 arm. We used the https://github.com/abr/abr_jaco2 repo for interfacing. If you'd like to see an example of the arm simulation with adaptive control you can check out our examples in the ABR Control repo https://github.com/abr/abr_control/blob/main/docs/examples/Mujoco/force_osc_xyz_dynamics_adaptation.py
You'll need to have Mujoco and our repo installed, but everything you need to simulate adaptive control is there!
Traceback (most recent call last): File "rover.py", line 299, in
weights_name=weights,
File "rover.py", line 66, in demo
input_scale=np.array([steer_scale, accel_scale]),
File "/home/user/nengo-interfaces/nengo_interfaces/mujoco.py", line 87, in init
self.model = mjp.load_model_from_path(self.xml_file)
File "mujoco_py/cymj.pyx", line 132, in mujoco_py.cymj.load_model_from_path
Exception: Failed to load XML file: rover.xml. mj_loadXML error: b"Error: sizes must be positive in object 'floor' (id = 0)\nObject name = floor, id = 0, line = 30, column = 9"