clearpathrobotics / clearpath_config

Clearpath Configuration YAML Parser
https://docs.clearpathrobotics.com/
BSD 3-Clause "New" or "Revised" License
9 stars 9 forks source link

AttributeError: 'str' object has no attribute 'items' #23

Closed AmmarW closed 1 year ago

AmmarW commented 1 year ago

Unable to generate launch files 'platform-service.launch.py' when running ros2 launch clearpath_gz simulation.launch.py.

Error log as follows:

[INFO] [launch]: All log files can be found below /home/ammar/.ros/log/2023-07-29-16-44-46-224914-aw-asus-38222 [INFO] [launch]: Default logging verbosity is set to INFO [INFO] [ruby $(which ign) gazebo-1]: process started with pid [38223] [INFO] [parameter_bridge-2]: process started with pid [38226] [INFO] [generate_description-3]: process started with pid [38228] [parameter_bridge-2] [INFO] [1690631086.365854468] [clock_bridge]: Creating GZ->ROS Bridge: [/clock (ignition.msgs.Clock) -> /clock (rosgraph_msgs/msg/Clock)] (Lazy 0) [generate_description-3] Traceback (most recent call last): [generate_description-3] File "/home/ammar/clearpath_ws/install/clearpath_generator_common/lib/clearpath_generator_common/generate_description", line 46, in <module> [generate_description-3] main() [generate_description-3] File "/home/ammar/clearpath_ws/install/clearpath_generator_common/lib/clearpath_generator_common/generate_description", line 42, in main [generate_description-3] dg.generate() [generate_description-3] File "/home/ammar/clearpath_ws/install/clearpath_generator_common/local/lib/python3.10/dist-packages/clearpath_generator_common/description/generator.py", line 74, in generate [generate_description-3] self.generate_sensors() [generate_description-3] File "/home/ammar/clearpath_ws/install/clearpath_generator_common/local/lib/python3.10/dist-packages/clearpath_generator_common/description/generator.py", line 166, in generate_sensors [generate_description-3] sensors = self.clearpath_config.sensors.get_all_sensors() [generate_description-3] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/clearpath_config.py", line 187, in sensors [generate_description-3] self._sensors.config[self.SENSORS]) [generate_description-3] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/common/types/config.py", line 87, in config [generate_description-3] self.getter(prop)() [generate_description-3] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/sensors/sensors.py", line 297, in camera [generate_description-3] value=self._camera.to_dict() [generate_description-3] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/sensors/sensors.py", line 213, in to_dict [generate_description-3] d.append(accessory.to_dict()) [generate_description-3] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/sensors/types/sensor.py", line 97, in to_dict [generate_description-3] d['ros_parameters'] = self.get_ros_parameters() [generate_description-3] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/sensors/types/sensor.py", line 214, in get_ros_parameters [generate_description-3] return self.ros_parameters [generate_description-3] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/sensors/types/sensor.py", line 198, in ros_parameters [generate_description-3] d[node_name] = flatten_dict(d[node_name]) [generate_description-3] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/common/utils/dictionary.py", line 43, in flatten_dict [generate_description-3] return dict(_flatten_dict_gen(d, parent_key, dlim)) [generate_description-3] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/common/utils/dictionary.py", line 34, in _flatten_dict_gen [generate_description-3] for k, v in d.items(): [generate_description-3] AttributeError: 'str' object has no attribute 'items' [ERROR] [generate_description-3]: process has died [pid 38228, exit code 1, cmd '/home/ammar/clearpath_ws/install/clearpath_generator_common/lib/clearpath_generator_common/generate_description -s /home/ammar/clearpath/ --ros-args -r __node:=generate_description']. [INFO] [generate_launch-4]: process started with pid [38247] [generate_launch-4] Traceback (most recent call last): [generate_launch-4] File "/opt/ros/humble/lib/clearpath_generator_gz/generate_launch", line 46, in <module> [generate_launch-4] main() [generate_launch-4] File "/opt/ros/humble/lib/clearpath_generator_gz/generate_launch", line 42, in main [generate_launch-4] glg.generate() [generate_launch-4] File "/home/ammar/clearpath_ws/install/clearpath_generator_common/local/lib/python3.10/dist-packages/clearpath_generator_common/launch/generator.py", line 79, in generate [generate_launch-4] self.generate_sensors() [generate_launch-4] File "/opt/ros/humble/local/lib/python3.10/dist-packages/clearpath_generator_gz/launch/generator.py", line 228, in generate_sensors [generate_launch-4] sensors = self.clearpath_config.sensors.get_all_sensors() [generate_launch-4] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/clearpath_config.py", line 187, in sensors [generate_launch-4] self._sensors.config[self.SENSORS]) [generate_launch-4] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/common/types/config.py", line 87, in config [generate_launch-4] self.getter(prop)() [generate_launch-4] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/sensors/sensors.py", line 297, in camera [generate_launch-4] value=self._camera.to_dict() [generate_launch-4] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/sensors/sensors.py", line 213, in to_dict [generate_launch-4] d.append(accessory.to_dict()) [generate_launch-4] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/sensors/types/sensor.py", line 97, in to_dict [generate_launch-4] d['ros_parameters'] = self.get_ros_parameters() [generate_launch-4] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/sensors/types/sensor.py", line 214, in get_ros_parameters [generate_launch-4] return self.ros_parameters [generate_launch-4] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/sensors/types/sensor.py", line 198, in ros_parameters [generate_launch-4] d[node_name] = flatten_dict(d[node_name]) [generate_launch-4] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/common/utils/dictionary.py", line 43, in flatten_dict [generate_launch-4] return dict(_flatten_dict_gen(d, parent_key, dlim)) [generate_launch-4] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/common/utils/dictionary.py", line 34, in _flatten_dict_gen [generate_launch-4] for k, v in d.items(): [generate_launch-4] AttributeError: 'str' object has no attribute 'items' [ERROR] [generate_launch-4]: process has died [pid 38247, exit code 1, cmd '/opt/ros/humble/lib/clearpath_generator_gz/generate_launch -s /home/ammar/clearpath/ --ros-args -r __node:=generate_launch']. [INFO] [generate_param-5]: process started with pid [38263] [ruby $(which ign) gazebo-1] Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway. [generate_param-5] Generated config: /home/ammar/clearpath/platform/config/control.yaml [generate_param-5] Generated config: /home/ammar/clearpath/platform/config/imu_filter.yaml [generate_param-5] Traceback (most recent call last): [generate_param-5] File "/opt/ros/humble/lib/clearpath_generator_gz/generate_param", line 46, in <module> [generate_param-5] main() [generate_param-5] File "/opt/ros/humble/lib/clearpath_generator_gz/generate_param", line 42, in main [generate_param-5] gpg.generate() [generate_param-5] File "/home/ammar/clearpath_ws/install/clearpath_generator_common/local/lib/python3.10/dist-packages/clearpath_generator_common/param/generator.py", line 64, in generate [generate_param-5] self.generate_platform() [generate_param-5] File "/opt/ros/humble/local/lib/python3.10/dist-packages/clearpath_generator_gz/param/generator.py", line 49, in generate_platform [generate_param-5] platform_param.generate_parameters(use_sim_time=True) [generate_param-5] File "/home/ammar/clearpath_ws/install/clearpath_generator_common/local/lib/python3.10/dist-packages/clearpath_generator_common/param/platform.py", line 140, in generate_parameters [generate_param-5] imus = self.clearpath_config.sensors.get_all_imu() [generate_param-5] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/clearpath_config.py", line 187, in sensors [generate_param-5] self._sensors.config[self.SENSORS]) [generate_param-5] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/common/types/config.py", line 87, in config [generate_param-5] self.getter(prop)() [generate_param-5] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/sensors/sensors.py", line 297, in camera [generate_param-5] value=self._camera.to_dict() [generate_param-5] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/sensors/sensors.py", line 213, in to_dict [generate_param-5] d.append(accessory.to_dict()) [generate_param-5] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/sensors/types/sensor.py", line 97, in to_dict [generate_param-5] d['ros_parameters'] = self.get_ros_parameters() [generate_param-5] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/sensors/types/sensor.py", line 214, in get_ros_parameters [generate_param-5] return self.ros_parameters [generate_param-5] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/sensors/types/sensor.py", line 198, in ros_parameters [generate_param-5] d[node_name] = flatten_dict(d[node_name]) [generate_param-5] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/common/utils/dictionary.py", line 43, in flatten_dict [generate_param-5] return dict(_flatten_dict_gen(d, parent_key, dlim)) [generate_param-5] File "/home/ammar/clearpath_ws/build/clearpath_config/clearpath_config/common/utils/dictionary.py", line 34, in _flatten_dict_gen [generate_param-5] for k, v in d.items(): [generate_param-5] AttributeError: 'str' object has no attribute 'items' [ruby $(which ign) gazebo-1] [Wrn] [FuelClient.cc:1978] The fuel.ignitionrobotics.org URL is deprecrated. Pleasse change https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/Warehouse to https://fuel.gazebosim.org/1.0/OpenRobotics/models/Warehouse [ERROR] [generate_param-5]: process has died [pid 38263, exit code 1, cmd '/opt/ros/humble/lib/clearpath_generator_gz/generate_param -s /home/ammar/clearpath/ --ros-args -r __node:=generate_launch']. [ERROR] [launch]: Caught exception in launch (see debug for traceback): [Errno 2] No such file or directory: '/home/ammar/clearpath/platform/launch/platform-service.launch.py'

luis-camero commented 1 year ago

Unfortunately, you happened to use the samples as we were in the process of updating them to match the changes we've been making. In this case the change relates to the ros_parameters tag that exists under every sensor. Now, you must include the name of the node under ros_parameters.

For example, now in our updated parameters:

    ros_parameters:
      velodyne_driver_node:
        frame_id: lidar3d_0_laser
        device_ip: 192.168.131.25
        port: 2368
        model: VLP16
      velodyne_convert_node:
        model: VLP16
        fixed_frame: lidar3d_0_laser
        target_frame: lidar3d_0_laser

The Velodyne driver is composed of two nodes. With this change it is clear what parameters belong to each node.