Closed xela-95 closed 1 month ago
I'm waiting for #21 to be fixed and be able to run on a server the same notebook, but the implementation is now complete.
Thanks @xela-95 for this PR! I left minor nits (non-blocking). I'm facing the following problem when running the notebook, does it reproduce also on other setups?
AttributeError Traceback (most recent call last) Cell In[6], line 15 13 step_length = 0.1 14 mpc = CentroidalMPC(robot_model=robot_model_init, step_length=step_length) ---> 15 mpc.intialize_mpc(mpc_parameters=mpc_parameters) 17 # Set desired quantities 18 mpc.configure(s_init=s_0, H_b_init=H_b_0) File ~/git/comodo/src/comodo/centroidalMPC/centroidalMPC.py:93, in CentroidalMPC.intialize_mpc(self, mpc_parameters) 91 self.contact_0_handler.set_parameter_int("number_of_corners", 4) 92 self.contact_0_handler.set_parameter_string("contact_name", "left_foot") ---> 93 self.contact_0_handler.set_parameter_vector_float("corner_0",self.robot_model.corner_0) 94 self.contact_0_handler.set_parameter_vector_float("corner_1", self.robot_model.corner_1) 95 self.contact_0_handler.set_parameter_vector_float( 96 "corner_2", self.robot_model.corner_2 97 ) AttributeError: 'RobotModel' object has no attribute 'corner_0'
Should be fixed by https://github.com/ami-iit/comodo/pull/20#discussion_r1797271024
Thanks @xela-95 for this PR! I left minor nits (non-blocking). I'm facing the following problem when running the notebook, does it reproduce also on other setups?
Thanks for the review @diegoferigo! Since I detached this branch from a previous fork of @flferretti, I built my code on his changes, and some of them were needed for this notebook to run correctly (I had these local changes active on my machine). I will update the PR soon to include the missing changes to comodo.
After the fix reported in https://github.com/ami-iit/comodo/pull/20#discussion_r1797271024, FYI I still get the following error, likely related to the changes you still need to port here:
In [22]:
...:
...: now = time.perf_counter()
...:
...: logs = simulate(T=T, js=js, tsid=tsid, mpc=mpc, s_ref=s_0)
...:
...: wall_time = time.perf_counter() - now
...: avg_iter_time_ms = (wall_time / (T / js_dt)) * 1000
...:
...: print(
...: f"\nRunning simulation took {wall_time:.2f}s for {T:.3f}s simulated time. \nIteration avg time of {avg_iter_time_ms:.1f} ms."
...: )
...: print(f"RTF: {T / wall_time * 100:.2f}%")
n_step_mpc_tsid=10, n_step_tsid_js=20
Exception during simulation at time0.0: 'CentroidalMPC' object has no attribute 'com_traj'
Traceback (most recent call last):
File "<ipython-input-21-57d7e1812ec4>", line 52, in simulate
mpc.update_references()
File "/home/dferigo/git/comodo/src/comodo/centroidalMPC/centroidalMPC.py", line 215, in update_references
self.com_traj = self.com_traj[1:]
AttributeError: 'CentroidalMPC' object has no attribute 'com_traj'
Running simulation took 0.00s for 6.000s simulated time.
Iteration avg time of 0.0 ms.
RTF: 347104.11%
@CarlottaSartore this PR is ready for your review :)
Great @xela-95 thank you ! Merging !
In this PR I'm adding support for JaxSim simulator and explaining how to use its interface with a notebook similar to the ones already available for the other simulators.