clearpathrobotics / clearpath_simulator

BSD 3-Clause "New" or "Revised" License
8 stars 6 forks source link

Sensors can't be equipped in the robot #12

Closed fmrico closed 10 months ago

fmrico commented 10 months ago

This is NOT the same issue as #11

serial_number: a200-0000
version: 0
system:
  hosts:
    self: cpr-a200-0000
    platform:
      cpr-a200-0000: 192.168.131.1
    onboard: {}
    remote: {}
  ros2:
    username: administrator
    namespace: a200_0000
    domain_id: 0
    rmw_implementation: rmw_fastrtps_cpp
platform:
  controller: ps4
  decorations:
    front_bumper:
      enabled: true
      model: default
      xyz: [0.0, 0.0, 0.0]
      rpy: [0.0, 0.0, 0.0]
      extension: 0.0
    rear_bumper:
      enabled: true
      model: default
      xyz: [0.0, 0.0, 0.0]
      rpy: [0.0, 0.0, 0.0]
      extension: 0.0
    structure:
      enabled: true
      model: sensor_arch_300
      xyz: [0.0, 0.0, 0.0]
      rpy: [0.0, 0.0, 0.0]
    top_plate:
      enabled: true
      model: pacs
      xyz: [0.0, 0.0, 0.0]
      rpy: [0.0, 0.0, 0.0]
  extras:
    urdf: null
    control: null
accessories:
  box:
    - name: user_bay_cover
      parent: top_plate_link
      xyz: [0.0, 0.0, 0.00735]
      rpy: [0.0, 0.0, 0.0]
      size: [0.4, 0.4, 0.002]
  cylinder: []
  link: []
  mesh: []
  sphere: []
mounts:
  bracket:
    - parent: top_plate_mount_d1
      xyz: [0.0, 0.0, 0.0]
      rpy: [0.0, 0.0, 0.0]
      model: horizontal
  fath_pivot:
    - parent: sensor_arch_mount
      xyz: [0.0, 0.0, -0.021]
      rpy: [3.1415, 0.0, 0.0]
      angle: 0.0
  riser: []
sensors:
  camera:
    - model: intel_realsense
      urdf_enabled: true
      launch_enabled: true
      parent: top_plate_link
      xyz: [0.0, 0.0, 0.0]
      rpy: [0.0, 0.0, 0.0]
      ros_parameters:
        camera_name: camera_0
        device_type: d435
        serial_no: "0"
        enable_color: true
        rgb_camera.profile: 640,480,30
        enable_depth: true
        depth_module.profile: 640,480,30
        pointcloud.enable: true
  gps: []
  imu: []
  lidar2d:
    - model: hokuyo_ust
      urdf_enabled: true
      launch_enabled: true
      parent: top_plate_link
      xyz: [0.0, 0.0, 0.0]
      rpy: [0.0, 0.0, 0.0]
      ros_parameters:
        laser_frame_id: lidar2d_0_laser
        ip_address: 192.168.131.20
        ip_port: 10940
        angle_min: -3.141592653589793
        angle_max: 3.141592653589793
  lidar3d:
    - model: velodyne_lidar
      urdf_enabled: true
      launch_enabled: true
      parent: top_plate_link
      xyz: [0.0, 0.0, 0.0]
      rpy: [0.0, 0.0, 0.0]
      ros_parameters:
        frame_id: lidar3d_0_laser
        device_ip: 192.168.131.25
        port: 2368
        model: VLP16
        fixed_frame: lidar3d_0_laser
        target_frame: lidar3d_0_laser

It is supposed to work.

Actual behaviour I get an error processing the file. For each sensor (I suppose):

[generate_description-1] Traceback (most recent call last):
[generate_description-1]   File "/home/fmrico/ros/ros2/nav3d_ws/install/clearpath_generator_common/lib/clearpath_generator_common/generate_description", line 46, in <module>
[generate_description-1]     main()
[generate_description-1]   File "/home/fmrico/ros/ros2/nav3d_ws/install/clearpath_generator_common/lib/clearpath_generator_common/generate_description", line 42, in main
[generate_description-1]     dg.generate()
[generate_description-1]   File "/home/fmrico/ros/ros2/nav3d_ws/install/clearpath_generator_common/local/lib/python3.10/dist-packages/clearpath_generator_common/description/generator.py", line 74, in generate
[generate_description-1]     self.generate_sensors()
[generate_description-1]   File "/home/fmrico/ros/ros2/nav3d_ws/install/clearpath_generator_common/local/lib/python3.10/dist-packages/clearpath_generator_common/description/generator.py", line 166, in generate_sensors
[generate_description-1]     sensors = self.clearpath_config.sensors.get_all_sensors()
[generate_description-1]   File "/home/fmrico/ros/ros2/nav3d_ws/build/clearpath_config/clearpath_config/clearpath_config.py", line 187, in sensors
[generate_description-1]     self._sensors.config[self.SENSORS])
[generate_description-1]   File "/home/fmrico/ros/ros2/nav3d_ws/build/clearpath_config/clearpath_config/common/types/config.py", line 87, in config
[generate_description-1]     self.getter(prop)()
[generate_description-1]   File "/home/fmrico/ros/ros2/nav3d_ws/build/clearpath_config/clearpath_config/sensors/sensors.py", line 303, in camera
[generate_description-1]     value=self._camera.to_dict()
[generate_description-1]   File "/home/fmrico/ros/ros2/nav3d_ws/build/clearpath_config/clearpath_config/sensors/sensors.py", line 219, in to_dict
[generate_description-1]     d.append(accessory.to_dict())
[generate_description-1]   File "/home/fmrico/ros/ros2/nav3d_ws/build/clearpath_config/clearpath_config/sensors/types/sensor.py", line 97, in to_dict
[generate_description-1]     d['ros_parameters'] = self.get_ros_parameters()
[generate_description-1]   File "/home/fmrico/ros/ros2/nav3d_ws/build/clearpath_config/clearpath_config/sensors/types/sensor.py", line 214, in get_ros_parameters
[generate_description-1]     return self.ros_parameters
[generate_description-1]   File "/home/fmrico/ros/ros2/nav3d_ws/build/clearpath_config/clearpath_config/sensors/types/sensor.py", line 198, in ros_parameters
[generate_description-1]     d[node_name] = flatten_dict(d[node_name])
[generate_description-1]   File "/home/fmrico/ros/ros2/nav3d_ws/build/clearpath_config/clearpath_config/common/utils/dictionary.py", line 43, in flatten_dict
[generate_description-1]     return dict(_flatten_dict_gen(d, parent_key, dlim))
[generate_description-1]   File "/home/fmrico/ros/ros2/nav3d_ws/build/clearpath_config/clearpath_config/common/utils/dictionary.py", line 34, in _flatten_dict_gen
[generate_description-1]     for k, v in d.items():
[generate_description-1] AttributeError: 'str' object has no attribute 'items'
[ERROR] [generate_description-1]: process has died [pid 513949, exit code 1, cmd '/home/fmrico/ros/ros2/nav3d_ws/install/clearpath_generator_common/lib/clearpath_generator_common/generate_description -s /home/fmrico/clearpath/ --ros-args -r __node:=generate_description'].

To Reproduce Simply follow your instructions:

  1. Clone the above packages in a workspace and build
  2. store the robot.yaml file I shown before in ~/clearpath/
  3. ros2 launch clearpath_gz gz_sim.launch.py
  4. ros2 launch clearpath_gz robot_spawn.launch.py
roni-kreinin commented 10 months ago

@fmrico The format for setting the ros_parameters has changed. You now need to add the node name before the parameters. See the sample for details. The documentation will be updated shortly.

tonybaltovski commented 10 months ago

# Closing due to inactivity. Please feel free to re-open if issue persists.