Error in loading json

Hi RRC team,

It looks like there is a json error when trying to load the goal.json inside the real_trajectory_example_with_gym script. Any suggestions here?

Traceback (most recent call last):          
  File "path/to//install/rrc21/lib/rrc21/real_trajectory_example_with_gym", line 11, in <module>
    load_entry_point('rrc21==2.0.0', 'console_scripts', 'real_trajectory_example_with_gym')() 
  File "/path/to/install/rrc21/lib/python3.8/site-packages/rrc_example_package/scripts/real_trajectory_example_with_gym.py", line 51, in main
    goal = json.loads(goal_json)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The error looks like if an empty string is passed to json.loads. Can you check if the goal is passed properly to the script in run? The run file should probably look something like this:

ros2 run rrc_example_package real_trajectory_example_with_gym "$@"

If this looks good, I suggest to print goal_json before decoding it, so we can see what is really passed to json.

@felix.widmaier Yup, as mentioned the run file is exactly how it is in the rrc_example_package. goal_json is the name of the json file - goal.json.

Hm, it shouldn’t be the file name, but the actual content of the file that is passed there. Is this issue on the submission system or when running in simulation? In the latter case, can you post the command you use to run it?

Ah, I see. Then it is my fault. I’m using neither, im just directly running real_trajectory_example_with_gym on my local machine to debug why it is not printing a few print statements I added within the same script when I launch it with the simulation. My bad. Thanks for the clarification.

Glad to hear the issue is solved!