leggedrobotics / ocs2

Optimal Control for Switched Systems
https://leggedrobotics.github.io/ocs2
BSD 3-Clause "New" or "Revised" License
874 stars 225 forks source link

Run train.py in ocs2_ballbot_mpcnet but stuck at waiting for the first data #68

Open EricTonyLiu opened 1 year ago

EricTonyLiu commented 1 year ago

Describe the bug I set up and install all the dependency of MPC-Net and then i run the train.py in ocs2_ballbot_mpcnet, it seems everything goes well but the program stuck at waiting for the first data, i dont know whether should i launch another file such as an simulation enviroment?

To Reproduce Steps to reproduce the behavior:

  1. Go to '~/osc2_ws/src/ocs2/ocs2_mpcnet/ocs2_ballbot_mpcnet/python/ocs2_ballbot_mpcnet
  2. Run train,py
  3. The program stuck at here

Screenshots

[CppAdInterface] Loading Shared Library: /home/rmua1/osc2_ws/src/ocs2/ocs2_robotic_examples/ocs2_ballbot/auto_generated/ballbot_dynamics_flow_map/cppad_generated/ballbot_dynamics_flow_map_lib.so [CppAdInterface] Loading Shared Library: /home/rmua1/osc2_ws/src/ocs2/ocs2_robotic_examples/ocs2_ballbot/auto_generated/ballbot_dynamics_jump_map/cppad_generated/ballbot_dynamics_jump_map_lib.so [CppAdInterface] Loading Shared Library: /home/rmua1/osc2_ws/src/ocs2/ocs2_robotic_examples/ocs2_ballbot/auto_generated/ballbot_dynamics_guard_surfaces/cppad_generated/ballbot_dynamics_guard_surfaces_lib.so

Rollout Settings:

=============================================================================

'AbsTolODE'..........................................................1e-05

'RelTolODE'..........................................................0.001

'maxNumStepsPerSecond'..............................................100000

'timeStep'............................................................0.01

'integratorType'.....................................................ODE45 (default)

'checkNumericalStability'................................................0

'reconstructInputTrajectory'.............................................1 (default)

'rootFindingAlgorithm'...................................................0 (default)

'maxSingleEventIterations'..............................................10 (default)

'useTrajectorySpreadingController'.......................................0 (default)

=============================================================================

============== Waiting for first data.

Additional context I think the data-generation is failed but i dont know how to fix it

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/rmua1/osc2_ws/src/ocs2/ocs2_mpcnet/ocs2_ballbot_mpcnet/python/ocs2_ballbot_mpcnet/train.py", line 71, in main(root_dir, "ballbot.yaml") File "/home/rmua1/osc2_ws/src/ocs2/ocs2_mpcnet/ocs2_ballbot_mpcnet/python/ocs2_ballbot_mpcnet/train.py", line 63, in main mpcnet.train() File "/home/rmua1/osc2_ws/src/ocs2/ocs2_mpcnet/ocs2_mpcnet_core/python/ocs2_mpcnet_core/mpcnet.py", line 328, in train time.sleep(1.0) KeyboardInterrupt

In "/home/rmua1/osc2_ws/src/ocs2/ocs2_mpcnet/ocs2_mpcnet_core/python/ocs2_mpcnet_core/mpcnet.py

areske commented 1 year ago

Hi @EricTonyLiu, I just did a new setup following these instructions:

And it work on my machine. Can you please double-check if you exactly followed all of those instructions? Also, can you try deploying the default policy with roslaunch ocs2_ballbot_mpcnet ballbot_mpcnet.launch?

EricTonyLiu commented 1 year ago

Thank you for your replyment. Yes, i followed the step and install the ocs2 and raisim, the other example such as ocs2_quadrotor works fine to me, i ran roslaunch ocs2_ballbot_mpcnet ballbot_mpcnet.launch, the default policy deployment also works fine my virtual environment is annaconda rather than vens, i dont know whether this needs other setup, at first the environment cannot find the python package like the ocs2-mpcnet_core so i export the python path, then i can run the train.py, but still stuck at Waiting for first data. maybe someone can tell me whether the data come from so i can debug it? thanks a lot

SarveshS325 commented 1 year ago

I am facing the same issue. Installed everything following the documentation. Default policy works fine too. On running train.py, the parameters are printed in the terminal 3 times for some reason and finally shows "waiting for 1st data"

areske commented 1 year ago

@SarveshS325 What are you using for creating the virtual environment?

SarveshS325 commented 1 year ago

I used venv to create the virtual environment with access to the system python. I also had to install onnx with pip in the virtual environment in addition to the steps mentioned in the documentation.

areske commented 1 year ago

@EricTonyLiu and @SarveshS325 Can you please send me the output when you type sudo apt list --installed | grep pybind in the terminal?

SarveshS325 commented 1 year ago

ros-noetic-pybind11-catkin/focal,now 2.10.3-2focal.20230213.204608 amd64 [installed,automatic]. It's the one installed along with ROS

areske commented 1 year ago

Aha, I suspect that it might break with the newest pybind version. Can you add this version to your workspace and try again? git clone git@github.com:wxmerkt/pybind11_catkin.git -b 2.5.0

SarveshS325 commented 1 year ago

Did a clean build with versions 2.5.0 and 2.4.3 pybind. Doesn't change anything

areske commented 1 year ago

To be sure that it doesn't fix it, did you remove the globally installed package, e.g. sudo apt purge ros-noetic-pybind11-catkin?

SarveshS325 commented 1 year ago

That should make no difference because I am replacing it the workspace

Toto-0 commented 1 year ago

I am currently in the same situation having the same problem: I have followed the installation guide, adding only the installation of onnx through pip install, and the execution of train.py is stuck on "waiting for first data". Has someone found a solution so far?

STaliani commented 1 year ago

I am currently in the same situation having the same problem: I have followed the installation guide, adding only the installation of onnx through pip install, and the execution of train.py is stuck on "waiting for first data". Has someone found a solution so far?

I have the same problem too @rubengrandia may we have some suggestions please? CC: @Toto-0

Knight-xiao commented 7 months ago

I have the same problems like you. when I execute the train.py, it always stuck on "waiting for the first data". Has someone found a solution now? @Toto-0 @STaliani