chengxuxin / extreme-parkour Goto Github PK
View Code? Open in Web Editor NEWICRA 2024: Train your parkour robot in less than 20 hours.
Home Page: https://extreme-parkour.github.io
License: Other
ICRA 2024: Train your parkour robot in less than 20 hours.
Home Page: https://extreme-parkour.github.io
License: Other
Hello!
Thank you for your great open source work. I am currently attempting to implement your work on a real robot. I have observed that the depth images captured by the RealSense camera are quite noisy.
I would be gratefull if you could tell me how you processed image in deployment on real robot. Have you used any filtering(like hole filling filter or temporal filter)? In the paper you write "We preprocess the image by cropping dead pixels from the left hand side and downsampling to 58 × 87" Is this the entirety of your image processing steps?
I appreciate your guidance on this matter.
Great work and thanks for the opensource!
I notice the code use estimator to predict privileged_states(base_lin_vel) in obs when training the teacher policy. And it isn't used later in training depth student policy and play.py. My understanding is that you still need the estimator to predict the base linear velocity when deploying the policy in reality.
So why don't you choose to use the estimator in depth student training pipeline or in the play.py code? Or perhaps i misunderstand your code.
Really looking forward to your explanation.
Thanks for your work! We are trying to deploy your policy on real go1 robot, but find the frequency so fast with dt=0.005 and decimation=4, may I ask the dt and decimation (may be other frequency parameters) you used on the hardware? thanks!
Thanks to your wonderful work.
I noticed that you set the position and angle in 'legged_robot_config.py' and I wonder how you verified the position and angle of the camera. Because I am trying to train a policy on aliengo by following your method, but I can't find any information about camera in unitree's urdf.
Can you help me?
Looking forward your reply.
With the depracation of Isaac Gym by NVIDIA, I am wondering if work is being done to make this work with Isaac Sim? This is a great project
In README.md file:
5. Save models for deployment:
python save_jit.py --exptid xxx-xx
After I finish this step, how can I deploy the model to a real robot?
Hello. I ran into the following problem while running the distillation strategy. How can I solve it?
The command is
python train.py --exptid yyy-yy-WHATEVER --device cuda:0 --resume --resumeid xxx-xx --delay --use_camera
Creating env...
100%|████████████████████████████████████████| 192/192 [00:00<00:00, 303.19it/s]
/home/adc/anaconda3/envs/parkour/lib/python3.8/site-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:3483.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
/home/adc/anaconda3/envs/parkour/lib/python3.8/site-packages/torchvision/transforms/functional.py:1603: UserWarning: The default value of the antialias parameter of all the resizing transforms (Resize(), RandomResizedCrop(), etc.) will change from None to True in v0.17, in order to be consistent across the PIL and Tensor backends. To suppress this warning, directly pass antialias=True (recommended, future default), antialias=None (current default, which means False for Tensors and True for PIL), or antialias=False (only works on Tensors - PIL will still use antialiasing). This also applies if you are using the inference transforms from the models weights: update the call to weights.transforms(antialias=True).
warnings.warn(
Using MLP and Priviliged Env encoder ActorCritic structure
ActorCritic.init got unexpected arguments, which will be ignored: ['continue_from_last_std', 'priv_encoder_dims', 'rnn_hidden_size', 'rnn_num_layers', 'rnn_type', 'tanh_encoder_output']
/home/adc/extreme-parkour/legged_gym/logs/parkour_new/xxx-xx
-1
Loading model from /home/adc/extreme-parkour/legged_gym/logs/parkour_new/xxx-xx-WHATEVER/model_4800.pt...
/home/adc/extreme-parkour/rsl_rl/rsl_rl/runners/on_policy_runner.py:506: UserWarning: 'depth_encoder_state_dict' key does not exist, not loading depth encoder...
warnings.warn("'depth_encoder_state_dict' key does not exist, not loading depth encoder...")
No saved depth actor, Copying actor critic actor to depth actor...
Traceback (most recent call last):
File "train.py", line 70, in
train(args)
File "train.py", line 65, in train
ppo_runner.learn(num_learning_iterations=train_cfg.runner.max_iterations, init_at_random_ep_len=True)
File "/home/adc/extreme-parkour/rsl_rl/rsl_rl/runners/on_policy_runner.py", line 255, in learn_vision
depth_latent_and_yaw = self.alg.depth_encoder(infos["depth"].clone(), obs_prop_depth) # clone is crucial to avoid in-place operation
File "/home/adc/anaconda3/envs/parkour/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/adc/extreme-parkour/rsl_rl/rsl_rl/modules/depth_backbone.py", line 32, in forward
depth_image = self.base_backbone(depth_image)
File "/home/adc/anaconda3/envs/parkour/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/adc/extreme-parkour/rsl_rl/rsl_rl/modules/depth_backbone.py", line 98, in forward
images_compressed = self.image_compression(images.unsqueeze(1))
File "/home/adc/anaconda3/envs/parkour/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/adc/anaconda3/envs/parkour/lib/python3.8/site-packages/torch/nn/modules/container.py", line 217, in forward
input = module(input)
File "/home/adc/anaconda3/envs/parkour/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/adc/anaconda3/envs/parkour/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 463, in forward
return self._conv_forward(input, self.weight, self.bias)
File "/home/adc/anaconda3/envs/parkour/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 459, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 106.00 MiB (GPU 0; 11.77 GiB total capacity; 6.69 GiB already allocated; 86.62 MiB free; 6.74 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
How to transplant the trained controller to a real quadruped robot A1?
Hi, I was wondering why the hidden_states are not being reset when the episode ends in the learn_vision
pipeline from the on_policy_runner
. I know that they are being detached but when the robot gets reset shouldn't it also have a fresh hidden state of none
instead of the previous episode's hidden_state
value ?
Thanks for the amazing repo..
Hello, when I try training the base policy for go2 python train.py --exptid 054-01-go1 --task go1
it learns to only use the front 2 legs and the back left leg. I tried training the a1 policy to see if it happens but that turned out fine and then I tried training go1 again and it learned 3 legs again. Is this something with the go1 config?
hi, do i need some permission about your project?
when i run " python train.py --exptid quadrupedal-locomotion --device cuda:0"
i got the follow message:
Importing module 'gym_38' (/home/xyb/lhz/isaacgym/python/isaacgym/_bindings/linux-x86_64/gym_38.so)
Setting GYM_USD_PLUG_INFO_PATH to /home/xyb/lhz/isaacgym/python/isaacgym/_bindings/linux-x86_64/usd/plugInfo.json
PyTorch version 1.10.0+cu113
Device count 1
/home/xyb/lhz/isaacgym/python/isaacgym/_bindings/src/gymtorch
Using /home/xyb/.cache/torch_extensions/py38_cu113 as PyTorch extensions root...
Emitting ninja build file /home/xyb/.cache/torch_extensions/py38_cu113/gymtorch/build.ninja...
Building extension module gymtorch...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
ninja: no work to do.
Loading extension module gymtorch...
wandb: Currently logged in as: 1710730875. Use wandb login --relogin
to force relogin
wandb: ERROR Error while calling W&B API: project not found (<Response [404]>)
Problem at: train.py 62 train
wandb: ERROR It appears that you do not have permission to access the requested resource. Please reach out to the project owner to grant you access. If you have the correct permissions, verify that there are no issues with your networking setup.(Error 404: Not Found)
Traceback (most recent call last):
File "train.py", line 73, in
train(args)
File "train.py", line 62, in train
wandb.init(project=args.proj_name, name=args.exptid, entity="parkour", group=args.exptid[:3], mode=mode, dir="../../logs")
File "/home/xyb/anaconda3/envs/parkour/lib/python3.8/site-packages/wandb/sdk/wandb_init.py", line 1185, in init
raise e
File "/home/xyb/anaconda3/envs/parkour/lib/python3.8/site-packages/wandb/sdk/wandb_init.py", line 1166, in init
run = wi.init()
File "/home/xyb/anaconda3/envs/parkour/lib/python3.8/site-packages/wandb/sdk/wandb_init.py", line 781, in init
raise error
wandb.errors.CommError: It appears that you do not have permission to access the requested resource. Please reach out to the project owner to grant you access. If you have the correct permissions, verify that there are no issues with your networking setup.(Error 404: Not Found)
Installing collected packages: zipp, six, pyparsing, packaging, kiwisolver, fonttools, cycler, contourpy, matplotlib, legged-gym
Running setup.py develop for legged-gym
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
bleach 6.0.0 requires webencodings, which is not installed.
ipykernel 6.25.0 requires psutil, which is not installed.
nbconvert 7.7.3 requires beautifulsoup4, which is not installed.
nbconvert 7.7.3 requires defusedxml, which is not installed.
pytest 7.3.1 requires pluggy<2.0,>=0.12, which is not installed.
Requested Action:
I am reporting this issue to request that the maintainers of the legged-gym
package modify their installation script to include the missing dependencies. This will help ensure a smoother installation process for users.
Additional Information:
Please let me know if there is any further information needed to address this issue. Thank you!
Hello!
I have a problem.The forward frequency of depth_encoder and depth_actor are different in learn_vision.The depth_encoder is 10 Hz, but depth_actor is 50 Hz. Why there is no problem, when depth_loss.backward() if I use "depth_encoder_loss + depth_actor_loss".
Great work. I've been dreaming about such a control algorithm being open sourced for running on the A1 since I got one a few years ago. It would be really cool if there was a guide on how to get this to run on the actual A1 robot.
I am using multiple GPUs to run the code, and I get an error when --device=cuda:1.
Error:
[Error] [carb.gym.plugin] Gym cuda error: an illegal memory access was encountered: ../../../source/plugins/carb/gym/impl/Gym/GymPhysX.cpp: 6211
[Error] [carb.gym.plugin] Gym cuda error: an illegal memory access was encountered: ../../../source/plugins/carb/gym/impl/Gym/GymPhysX.cpp: 6219
When I use command "python save_jit.py --exptid xxx-xx" I meet this error.
Traceback (most recent call last):
File "/home/adc/pycharm-community-2023.3.2/plugins/python-ce/helpers/pydev/pydevd.py", line 1534, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/adc/pycharm-community-2023.3.2/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/home/adc/extreme-parkour/legged_gym/legged_gym/scripts/save_jit.py", line 123, in
play(args)
File "/home/adc/extreme-parkour/legged_gym/legged_gym/scripts/save_jit.py", line 91, in play
policy.actor.load_state_dict(ac_state_dict['depth_actor_state_dict'], strict=True)
KeyError: 'depth_actor_state_dict'
How can I solve it?
Thanks for your contribution! Really appreciate you open source this work. I notice you reindex the dof orders when getting the observation, which has not been used in the original ETH code, what`s the reason of this? I directly change the URDF to new_go1, and tested with the weights you provided, but the robot performs like the dof is in a wrong order, I wander is this related to the reindex operation?
As you mentioned in READ.md:
Train 10-15k iterations (8-10 hours on 3090) (at least 15k recommended).
so, when you train 10-15k iterations,what's the number of envs?
it seems like i can only run the train.py with 50 envs on my 3080 (in the headless mode).
I'm looking fowrward to your reply.
The code uses history_encoder to predict the priv_latent and the update is in Func:update_dagger. So I have two questions:
Why not update dagger every learn_RL step? Instead, update history_encoder at a frequency of 20 Hz.
Why a temperature coefficient priv_reg_coef is needed? I am also confused about why the history_encoder loss/priv_reg_loss is added to the surrogate_loss?
I can't find the answer to the question in the paper.
Any help will be appreciated!
To visualize, it seems that .npy file is needed, but I dont see any file exporting it. How to obtain them and how to visualize?
does the code in evaluation.py currently match what was used for the paper results? did the paper results use any specific settings? I trained a phase 2 policy in my own repo which matched the training performance of a a phase 2 policy in your repo but my eval metrics are:
Mean reward: 8.81$\pm$5.61
Mean episode length: 380.12$\pm$255.50
Mean number of waypoints: 0.44$\pm$0.32
Mean edge violation: 0.16$\pm$0.44
which doesnt seem to match the paper results. Also, how can i view evaluate scores split up by terrain?
大家看到这个issue的可以一起讨论一下A1的部署问题吗?几乎所有的issue都指向部署
I have ran into an issue where I am able to train the model with the --use_camera tag after adding the following two lines before import issacgym in the play.py scripts.
os.environ['MESA_VK_DEVICE_SELECT'] = '10de:2206'
os.environ["CUDA_VISIBLE_DEVICES"] = '0'
I am training on a headless machine which runs the issaacgym docker environment with the package added on it.
When I am running the trained model the depth image screen shows up but it is completely blank.
I get some warnings when I run the code which are as below
/opt/test_see/lib/python3.8/site-packages/torchvision/transforms/functional.py:1603: UserWarning: The default value of the antialias parameter of all the resizing transforms (Resize(), RandomResizedCrop(), etc.) will change from None to True in v0.17, in order to be consistent across the PIL and Tensor backends. To suppress this warning, directly pass antialias=True (recommended, future default), antialias=None (current default, which means False for Tensors and True for PIL), or antialias=False (only works on Tensors - PIL will still use antialiasing). This also applies if you are using the inference transforms from the models weights: update the call to weights.transforms(antialias=True).
warnings.warn(
'train_cfg' provided -> Ignoring 'name=a1'
Using MLP and Priviliged Env encoder ActorCritic structure
ActorCritic.init got unexpected arguments, which will be ignored: ['continue_from_last_std', 'priv_encoder_dims', 'rnn_hidden_size', 'rnn_num_layers', 'rnn_type', 'tanh_encoder_output']
I have had no issues training the base policy.
Thank you.
Very impressed to see your demonstration on CoRL, it seems that the robot's velocity is controllable in both x and y direction in the demonstration, but the paper and code only take velocity in x-axis as input, is it done by the alternate of two policy or an new method not in the paper?
Hello, I am very interested in your work. I would like to know how this code can be deployed to a real robot, could you introduce how to deploy it?
i want to know the meaning of control.decimation. Looking forward to your reply
Hi,
During the distillation stage for training the vision encoder, it looks like the depth image inside info["depth"] used for computing the action comes from the previous step in the depth buffer, with the line
self.extras["depth"] = self.depth_buffer[:, -2] # have already selected last one
Why is the previous depth image used instead of the current step? Is this a way to impose depth image delay?
Thanks.
Hello Sir, may I ask when will the real robot support be available?
hey Xuxin, brilliant implementation! you mentioned you were planning on releasing the hardware code for unitree a1 robots, could you please let us know when you are planning on updating extreme parkour so we could test it out on real robots? I would really appreciate it if you could offer some insights.
Importing module 'gym_38' (/apps/IsaacGym_Preview_4_Package/isaacgym/python/isaacgym/_bindings/linux-x86_64/gym_38.so)
Setting GYM_USD_PLUG_INFO_PATH to /apps/IsaacGym_Preview_4_Package/isaacgym/python/isaacgym/_bindings/linux-x86_64/usd/plugInfo.json
PyTorch version 1.13.0+cu117
Device count 1
/apps/IsaacGym_Preview_4_Package/isaacgym/python/isaacgym/_bindings/src/gymtorch
Using /.cache/torch_extensions/py38_cu117 as PyTorch extensions root...
Emitting ninja build file /.cache/torch_extensions/py38_cu117/gymtorch/build.ninja...
Building extension module gymtorch...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
ninja: no work to do.
Loading extension module gymtorch...
Setting seed: 1
20
0.019999999552965164
Not connected to PVD
+++ Using GPU PhysX
Physics Engine: PhysX
Physics Device: cuda:0
GPU Pipeline: enabled
Start creating ground...
Converting heightmap to trimesh...
Created 12920000 vertices
Created 25825602 triangles
Adding trimesh to simulation...
Trimesh added
Finished creating ground. Time taken 53.78 s
Creating env...
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 6144/6144 [00:01<00:00, 5705.90it/s]
/anaconda3/envs/parkour/lib/python3.8/site-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:3190.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Using MLP and Priviliged Env encoder ActorCritic structure
ActorCritic.init got unexpected arguments, which will be ignored: ['continue_from_last_std', 'priv_encoder_dims', 'rnn_hidden_size', 'rnn_num_layers', 'rnn_type', 'tanh_encoder_output']
Traceback (most recent call last):
File "train.py", line 40, in
train(args)
File "train.py", line 35, in train
ppo_runner.learn(num_learning_iterations=train_cfg.runner.max_iterations, init_at_random_ep_len=True)
File "/Desktop/extreme-parkour-main/rsl_rl/rsl_rl/runners/on_policy_runner.py", line 168, in learn_RL
total_rew = self.alg.process_env_step(rewards, dones, infos)
File "/Desktop/extreme-parkour-main/rsl_rl/rsl_rl/algorithms/ppo.py", line 170, in process_env_step
self.transition.rewards += self.gamma * torch.squeeze(self.transition.values * infos['time_outs'].unsqueeze(1).to(self.device), 1)
AttributeError: 'NoneType' object has no attribute 'unsqueeze'
I was running the project, everything was fine until this error suddenly came out. I have run this project for several times, and already got some checkpoints successfully. Did anyone meet this problem? Thanks!
Hello, when I run the distillation policy, this error was returned, while everything goes fine during base policy training. Does anyone know how to solve this? Thanks a lot!
I know that it might be the problem of ubuntu version, is there any solution not to downgrade system?QAQ
command: python train.py --exptid 111-11 --resume --resumeid 000-00 --delay --use_camera --no_wandb
Importing module 'gym_38' (/home/user/apps/IsaacGym_Preview_4_Package/isaacgym/python/isaacgym/_bindings/linux-x86_64/gym_38.so)
Setting GYM_USD_PLUG_INFO_PATH to /home/user/apps/IsaacGym_Preview_4_Package/isaacgym/python/isaacgym/_bindings/linux-x86_64/usd/plugInfo.json
PyTorch version 1.10.0+cu113
Device count 1
/home/user/apps/IsaacGym_Preview_4_Package/isaacgym/python/isaacgym/_bindings/src/gymtorch
Using /home/user/.cache/torch_extensions/py38_cu113 as PyTorch extensions root...
Emitting ninja build file /home/user/.cache/torch_extensions/py38_cu113/gymtorch/build.ninja...
Building extension module gymtorch...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
ninja: no work to do.
Loading extension module gymtorch...
Setting seed: 1
Not connected to PVD
+++ Using GPU PhysX
Physics Engine: PhysX
Physics Device: cuda:0
GPU Pipeline: enabled
Start creating ground...
Converting heightmap to trimesh...
iteration 0 - triangles 3414402 threshold 2.187e-06
iteration 5 - triangles 1776036 threshold 0.00209715
iteration 10 - triangles 458906 threshold 0.0627485
simplified mesh in 2.6172 seconds from 3414402 to 170720 triangles
Created 88159 vertices
Created 170720 triangles
Adding trimesh to simulation...
Trimesh added
Finished creating ground. Time taken 4.11 s
Creating env...
0%| | 0/192 [00:00<?, ?it/s][Error] [carb.gym.plugin] cudaImportExternalMemory failed on rgbImage buffer with error 999
Segmentation fault (core dumped)
I fixed it with downgrade my ubuntu22.04 to 20.04. Seems the only way to fix it.
" File "train.py", line 66, in train
ppo_runner.learn(num_learning_iterations=train_cfg.runner.max_iterations, init_at_random_ep_len=True)
File "/home/hello/Aaron_Project/extreme-parkour/rsl_rl/rsl_rl/runners/on_policy_runner.py", line 165, in learn_RL
obs, privileged_obs, rewards, dones, infos = self.env.step(actions) # obs has changed to next_obs !! if done obs has been reset
File "/home/hello/Aaron_Project/extreme-parkour/legged_gym/legged_gym/envs/base/legged_robot.py", line 145, in step
self.post_physics_step()
File "/home/hello/Aaron_Project/extreme-parkour/legged_gym/legged_gym/envs/base/legged_robot.py", line 259, in post_physics_step
self.reset_idx(env_ids)
File "/home/hello/Aaron_Project/extreme-parkour/legged_gym/legged_gym/envs/base/legged_robot.py", line 327, in reset_idx
self._reset_dofs(env_ids)
File "/home/hello/Aaron_Project/extreme-parkour/legged_gym/legged_gym/envs/base/legged_robot.py", line 636, in _reset_dofs
self.dof_vel[env_ids] = 0.
RuntimeError: CUDA error: device-side assert triggered
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1."
i try to train base_policy,training is normal for the first few thousand rounds,but the error will occur every time i train for less than 10,000 rounds.
Looking forward to your reply,thanks
Hello, xuxin, thank you for your open-source work, it has been a great help to me. However, during step 2, which is the distillation process, I set up 4096 environments and trained for 5000 rounds. After completing the training, I tested it and found the results were not good. I carefully analyzed the source code and noticed that the depth_encoder seems not to have been trained because lines 303 and 311 in on_policy_runner.py were commented out. May I ask why this is the case? Should I uncomment the lines above mentioned?
Thanks :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.