gazebosim / ros_gz

Integration between ROS (1 and 2) and Gazebo simulation
https://gazebosim.org
Apache License 2.0
249 stars 138 forks source link

ros_gz_bridge parameter_bridge not parsing yaml files to create parameter bridges. #354

Closed Jack17432 closed 1 year ago

Jack17432 commented 1 year ago

Environment

Description

Steps to reproduce

  1. download any of the yaml examples in the ros_gz_bridge example files
  2. Use parameter_bridge from ros_gz_bridge use pass in 'config_file': path_to_config
  3. Run ros2 launch file

Output

image image

mjcarroll commented 1 year ago

Thanks for reporting, taking a look

mjcarroll commented 1 year ago

What happens if you run from command line, for example:

ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=./src/ros_gz/ros_gz_bridge/test/config/full.yaml
Jack17432 commented 1 year ago

image

mjcarroll commented 1 year ago

Okay, this indicates that it can find this file when loaded from the command line. I believe the error you are seeing is because the configuration is pointing to a file that does not exist.

I'm going to open a PR to make the error condition more explicit when you are trying to open a non-existent file.

The failure to load with ignition. prefixed messages is a second fix that I will need to add to maintain compatibility with the humble branch.

mjcarroll commented 1 year ago

@Jack17432 friendly ping, can you confirm that you were able to get this working with the improved error messages?

ghost commented 1 year ago

Hi @mjcarroll, I've encountered the same error trying to run a yaml file :

~$ ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=~/gazebo_ws/ros_bridge/config.yaml
[ERROR] [1687567401.137092983] [readFromYaml]: Could not parse config, top level must be a YAML sequence
[ERROR] [1687567402.136611339] [readFromYaml]: Could not parse config, top level must be a YAML sequence

I added the 'improved error messages" changes you made, to no effect.

the contents of config.yaml are just :

- topic_name: "/clock"
  ros_type_name: "rosgraph_msgs/msg/Clock"
  gz_type_name: "gz.msgs.Clock"
  subscriber_queue: 10       # Default 10
  publisher_queue: 10        # Default 10
  lazy: false                # Default "false"
  direction: GZ_TO_ROS       # Default "BIDIRECTIONAL" - Bridge both directions
                             # "GZ_TO_ROS" - Bridge GZ topic to ROS
                             # "ROS_TO_GZ" - Bridge ROS topic to GZ

Am I supposed to place that yaml file somewhere in particular?

azeey commented 1 year ago

Doesn't the GZ_TO_ROS need to be in quotes?

mjcarroll commented 1 year ago

Correct, "GZ_TO_ROS" should be in quotes.

mjcarroll commented 1 year ago

@Jack17432 since you haven't replied in some time, I'm going to close this out. Feel free to re-open or open a new issue if you have more troubles.

Ali-Hossam commented 4 months ago

If anyone happens to encounter the same error, make sure that you added the config folder that has the yaml file to CMakeLists install Directory.

MnM03 commented 4 months ago

Did someone solved this issue? I am having the same problem.

anushkav1888 commented 3 months ago

I was running parameter bridge node using a YAML config file through a python launch file, and encountered the same error. Make sure your config exists in install directory inside your workspace, and you define config file path correctly in your launch file (specify using get_package_share_directory or any other equivalents) .

simona-99 commented 1 month ago

Hi, I'm also getting the same error: [readFromYaml]: Could not parse config, top level must be a YAML sequence And when I run this:

ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=./src/ros_gz/ros_gz_bridge/test/config/full.yaml
[ERROR] [1727164413.215385465] [readFromYaml]: Could not parse config, top level must be a YAML sequence

I made sure to include the config folder containing the .yaml file in the CMakeLists.txt file:

install(DIRECTORY config/
  DESTINATION share/${PROJECT_NAME}/config
)

I also made sure that the config file exists in the install directory inside my workspace.

Thank you in advance for any help you can give me ;)