leggedrobotics / art_planner

Local Navigation Planner for Legged Robots
BSD 3-Clause "New" or "Revised" License
137 stars 20 forks source link

Build succeed, But Don't Work #12

Closed ZWT006 closed 1 year ago

ZWT006 commented 1 year ago

I install all dependences as readme, but it doesn't work, just source /devel/setup.bash and roslaunch art_planner_ros art_planner.launch , I got error as follows:

setting /run_id to 5c6ad48e-3664-11ee-907a-3f0007cad019
process[rosout-1]: started with pid [259380]
started core service [/rosout]
process[art_planner-2]: started with pid [259387]
process[art_planner/motion_cost_server-3]: started with pid [259388]
process[art_planner/plan_to_goal_client-4]: started with pid [259389]
Waiting for plan_to_goal server to appear...
Found server.
Traceback (most recent call last):
  File "/home/zwt/test_ws/devel_isolated/art_planner_motion_cost/lib/art_planner_motion_cost/cost_query_server.py", line 15, in <module>
    exec(compile(fh.read(), python_script, 'exec'), context)
  File "/home/zwt/test_ws/src/art_planner/art_planner_motion_cost/scripts/cost_query_server.py", line 175, in <module>
    server = GPUCostQueryServer()
  File "/home/zwt/test_ws/src/art_planner/art_planner_motion_cost/scripts/cost_query_server.py", line 27, in __init__
    self.cost_predictor = CostPredictor(cfg)
  File "/home/zwt/test_ws/src/art_planner/art_planner_motion_cost/src/art_planner_motion_cost/predictor/predictor.py", line 20, in __init__
    self.network.load_state_dict(torch.load(modelFile, map_location='cpu'))
  File "/home/zwt/.local/lib/python3.8/site-packages/torch/serialization.py", line 795, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/home/zwt/.local/lib/python3.8/site-packages/torch/serialization.py", line 1002, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, 'v'.
[art_planner/motion_cost_server-3] process has died [pid 259388, exit code 1, cmd /home/zwt/test_ws/devel_isolated/art_planner_motion_cost/lib/art_planner_motion_cost/cost_query_server.py ~map:=/elevation_mapping/elevation_map_raw __name:=motion_cost_server __log:=/home/zwt/.ros/log/5c6ad48e-3664-11ee-907a-3f0007cad019/art_planner-motion_cost_server-3.log].

How can I solve this problems?

lorenwel commented 1 year ago

Hi, the crash happens when loading the neural network weights for cost estimation. Either, you're using a Pytorch version other than 1.13 and this version does not support loading older weights (unlikely). Or, you did not have Git LFS installed when you cloned the repo (more likely). This would mean that the proper weights weren't downloaded, which would explain this issue. I assume this is the problem.

Please try installing Git LFS:

sudo apt install git-lfs
git lfs install

Then delete the repo and clone it again. You can verify if the download worked by checking the model file sizes in the art_planner_motion_cost/rsc/model directory. The file size should be ~4MB.

Please report back whether this fixes it or not. In the meantime, I will add the instructions to install Git LFS to the Readme. This is currently missing.

ZWT006 commented 1 year ago

Thank you very much for your help, I used git lfs clone that repository and launch succefully.😄

lorenwel commented 1 year ago

Happy to hear this solved it.