facebookresearch / facebookresearch/fairo

[Polymetis] `launch_robot.py robot_client=bullet_sim` crashes due to missing hydra conf values

Open
#1,420 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
929
Forks
123
PR merge metrics
No merged PRs in 30d

Description

## Type of Issue

Select the type of issue:
- [x] Bug report (to report a bug)
- [ ] Feature request (to request an additional feature)
- [ ] Tracker (I am just using this as a tracker)
- [ ] Refactor request
- [ ] Documentation Ask

## Description
When I follow the [polymetis usage](https://facebookresearch.github.io/fairo/polymetis/usage.html#running-the-server-and-robot-client-simulation) page and run the script for simulation mode `launch_robot.py robot_client=bullet_sim use_real_time=false gui=[true|false]`
I get the following error
```
File "/home/user/micromamba/envs/polymetis/lib/python3.8/site-packages/hydra/utils.py", line 70, in call
raise HydraException(f"Error calling '{cls}' : {e}") from e
hydra.errors.HydraException: Error calling 'polymetis.robot_client.metadata.RobotClientMetadata' : str interpolation key 'default_Kq' not found
full_key: default_Kq
reference_type=Any
object_type=dict
```

After checking around, simply replacing the config values in `bullet_sim.yaml` line 16-19 (`default_Kq`etc) https://github.com/facebookresearch/fairo/blob/0a01a7fa7a7c65b2f9a3aebf5e79040940daf9d2/polymetis/polymetis/conf/robot_client/bullet_sim.yaml#L16
with that of `empty_statistics_client.yaml` values worked. Specifying those value at runtime like the `bullet_sim.yaml`file seems to be (intended to?) used, like
```
launch_robot.py robot_client=bullet_sim default_Kq=[0, 0, 0, 0, 0, 0, 0]
```
Errors out that `default_Kq` is not defined in hydra, while following work
```
launch_robot.py robot_client=bullet_sim robot_client.metadata_cfg.default_Kq=[0,0,0,0,0,0,0] robot_client.metadata_cfg.default_Kqd=[0,0,0,0,0,0,0] robot_client.metadata_cfg.default_Kx=[0,0,0,0,0,0,0] robot_client.metadata_cfg.default_Kxd=[0,0,0,0,0,0,0]
```

## Current Behavior
Currently the code (graciously) crashes.

## Expected Behavior
Supposed to run the simulation server, probably with some appropriate default_K values? (I assume those are PID controller gains?)

## Steps to reproduce
1. Install Polymetis using micromamba (conda install just freezes for me) follow the install instructions. If using `micromamba` change the following line from `conda list`to `micromamba list` in this file https://github.com/facebookresearch/fairo/blob/0a01a7fa7a7c65b2f9a3aebf5e79040940daf9d2/polymetis/polymetis/python/polymetis/_version.py#L11 at your install location. (maybe supporting micromamba should also be raised as an issue?)
2. run the command `launch_robot.py robot_client=bullet_sim use_real_time=false gui=[true|false]`
Output: (username replaced)

```
(polymetis) user@nuc:~$ launch_robot.py robot_client=bullet_sim
/home/user/micromamba/envs/polymetis/lib/python3.8/site-packages/hydra/plugins/config_source.py:190: UserWarning:
Missing @package directive robot_client/bullet_sim.yaml in pkg://polymetis.conf.
See https://hydra.cc/docs/next/upgrades/0.11_to_1.0/adding_a_package_directive
warnings.warn(message=msg, category=UserWarning)
[2024-03-05 17:33:15,716][__main__][INFO] - Adding /home/user/micromamba/envs/polymetis/lib/python3.8/build to $PATH
[2024-03-05 17:33:15,717][__main__][INFO] - Starting server
[2024-03-05 17:33:15.894] [info] Using real time: false
[2024-03-05 17:33:15.894] [info] Using server address: localhost:50051
[2024-03-05 17:33:15.895] [info] Server listening on localhost:50051
[2024-03-05 17:33:15,926][__main__][INFO] - Starting robot client...
pybullet build time: Nov 5 2021 11:53:36
Traceback (most recent call last):
File "/home/user/micromamba/envs/polymetis/lib/python3.8/site-packages/hydra/utils.py", line 63, in call
return _instantiate_class(type_or_callable, config, *args, **kwargs)
File "/home/user/micromamba/envs/polymetis/lib/python3.8/site-packages/hydra/_internal/utils.py", line 499, in _instantiate_class
final_kwargs = _get_kwargs(config, **kwargs)
File "/home/user/micromamba/envs/polymetis/lib/python3.8/site-packages/hydra/_internal/utils.py", line 604, in _get_kwargs
final_kwargs[k] = params[k]
File "/home/user/micromamba/envs/polymetis/lib/python3.8/site-packages/omegaconf/dictconfig.py", line 321, in __getitem__
self._format_and_raise(key=key, value=None, cause=e)
File "/home/user/micromamba/envs/polymetis/lib/python3.8/site-packages/omegaconf/base.py", line 95, in _format_and_raise
format_and_raise(
File "/home/user/micromamba/envs/polymetis/lib/python3.8/site-packages/omegaconf/_utils.py", line 694, in format_and_raise
_raise(ex, cause)
File "/home/user/micromamba/envs/polymetis/lib/python3.8/site-packages/omegaconf/_utils.py", line 610, in _raise
raise ex # set end OC_CAUSE=1 for full backtrace
omegaconf.errors.ConfigKeyError: str interpolation key 'default_Kq' not found
full_key: default_Kq
reference_type=Any
object_type=dict

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/user/micromamba/envs/polymetis/lib/python3.8/site-packages/hydra/utils.py", line 63, in call
return _instantiate_class(type_or_callable, config, *args, **kwargs)
File "/home/user/micromamba/envs/polymetis/lib/python3.8/site-packages/hydra/_internal/utils.py", line 500, in _instantiate_class
return clazz(*args, **final_kwargs)
File "/home/user/micromamba/envs/polymetis/lib/python3.8/site-packages/polysim/grpc_sim_client.py", line 64, in __init__
super().__init__(metadata_cfg=metadata_cfg)
File "/home/user/micromamba/envs/polymetis/lib/python3.8/site-packages/polymetis/robot_client/abstract_robot_client.py", line 23, in __init__
self.metadata: RobotClientMetadata = hydra.utils.instantiate(metadata_cfg)
File "/home/user/micromamba/envs/polymetis/lib/python3.8/site-packages/hydra/utils.py", line 70, in call
raise HydraException(f"Error calling '{cls}' : {e}") from e
hydra.errors.HydraException: Error calling 'polymetis.robot_client.metadata.RobotClientMetadata' : str interpolation key 'default_Kq' not found
full_key: default_Kq
reference_type=Any
object_type=dict

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/user/micromamba/envs/polymetis/bin/launch_robot.py", line 83, in main
client = hydra.utils.instantiate(cfg.robot_client)
File "/home/user/micromamba/envs/polymetis/lib/python3.8/site-packages/hydra/utils.py", line 70, in call
raise HydraException(f"Error calling '{cls}' : {e}") from e
hydra.errors.HydraException: Error calling 'polysim.grpc_sim_client.GrpcSimulationClient' : Error calling 'polymetis.robot_client.metadata.RobotClientMetadata' : str interpolation key 'default_Kq' not found
full_key: default_Kq
reference_type=Any
object_type=dict

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
[2024-03-05 17:33:16,374][__main__][INFO] - Killing subprocess with pid 741733, pgid 741733...
Exception ignored in:
Traceback (most recent call last):
File "/home/user/micromamba/envs/polymetis/lib/python3.8/site-packages/polysim/grpc_sim_client.py", line 109, in __del__
self.channel.close()
AttributeError: 'GrpcSimulationClient' object has no attribute 'channel'
```

Also package versions
```
>>> import polymetis; polymetis.__version__
'1251_g0a01a7fa7'
>>> import hydra; hydra.__version__
'1.0.6'
```

## Links to any relevant pastes or documents
[usage docs
](https://facebookresearch.github.io/fairo/polymetis/usage.html#running-the-server-and-robot-client-simulation)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.