clearpathrobotics / clearpath_simulator

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

Issues to spawn a second robot #25

Open Mechaick opened 5 months ago

Mechaick commented 5 months ago

Please provide the following information:

ros2 launch clearpath_gz simulation.launch.py rviz:=true setup_path:=$HOME/clearpath/cp1

and spawning an additional robot using

ros2 launch clearpath_gz robot_spawn.launch.py setup_path:=$HOME/clearpath/cp5

And I should expect a robot completely working.

Actual behaviour I cannot drive the second robot.

The simulation give the following error messages: [ruby $(which ign) gazebo-1] [ERROR] [1704465289.453031469] [a200_0005.controller_manager]: The 'type' param was not defined for 'joint_state_broadcaster'. [ruby $(which ign) gazebo-1] [ERROR] [1704465289.533124046] [a200_0005.controller_manager]: The 'type' param was not defined for 'platform_velocity_controller'.

And the spawner:

[spawner-5] [FATAL] [1704465289.454854305] [a200_0005.spawner_joint_state_broadcaster]: Failed loading controller joint_state_broadcaster
[spawner-6] [FATAL] [1704465289.536445595] [a200_0005.spawner_platform_velocity_controller]: Failed loading controller platform_velocity_controller
[ERROR] [spawner-5]: process has died [pid 138988, exit code 1, cmd '/opt/ros/humble/lib/controller_manager/spawner --controller-manager-timeout 60 joint_state_broadcaster --ros-args -r __ns:=/a200_0005'].
[ERROR] [spawner-6]: process has died [pid 138990, exit code 1, cmd '/opt/ros/humble/lib/controller_manager/spawner --controller-manager-timeout 60 platform_velocity_controller --ros-args -r `__ns:=/a200_0005'].

To Reproduce Provide the steps to reproduce:

  1. Follow the installation tutorials
  2. Create a folder for each robot in -/clearpath/ (cp1 and cp5)
  3. Copy the example robot.yaml to each folder and change the serial number, host : self, and namespace to a200-0001 or 5.
    
    serial_number: a200-0001
    version: 0
    system:
    username: administrator
    hosts:
    self: cpr-a200-0001
    platform:
      cpr-a200-0000: 192.168.131.1
    onboard: {}
    remote: {}
    ros2:
    namespace: a200_0001
    domain_id: 0
    rmw_implementation: rmw_fastrtps_cpp
    workspaces: []
    platform:
    controller: ps4
    battery:
    model: ES20_12C
    configuration: S2P1
    attachments:
    - name: front_bumper
      type: bumper
      parent: front_bumper_mount
    - name: rear_bumper
      type: bumper
      parent: rear_bumper_mount
    - name: top_plate
      type: top_plate
      model: pacs
    - name: sensor_arch
      type: sensor_arch
      parent: default_mount
      model: sensor_arch_300
      enabled: true
    extras:
    urdf: null
    ros_parameters:
      platform_velocity_controller:
        linear.x.max_velocity": 1.0
        linear.x.min_velocity": -1.0
        linear.x.max_acceleration": 3.0
        linear.x.min_acceleration": -3.0
        angular.z.max_velocity": 2.0
        angular.z.min_velocity": -2.0
        angular.z.max_acceleration": 6.0
        angular.z.min_acceleration": -6.0
    links:
    box:
    - name: user_bay_cover
    parent: default_mount
    xyz: [0.0, 0.0, 0.0075]
    rpy: [0.0, 0.0, 0.0]
    size: [0.4, 0.4, 0.002]
    cylinder: []
    frame: []
    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: []
    disk: []
    post: []
    sensors:
    camera:
    - model: intel_realsense
    urdf_enabled: true
    launch_enabled: true
    parent: fath_pivot_0_mount
    xyz: [0.0, 0.0, 0.0]
    rpy: [0.0, 0.0, 0.0]
    ros_parameters:
      camera:
        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: bracket_0_mount
    xyz: [0.0, 0.0, 0.0]
    rpy: [0.0, 0.0, 0.0]
    ros_parameters:
      urg_node:
        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: sensor_arch_mount
    xyz: [0.0, 0.0, 0.0]
    rpy: [0.0, 0.0, 0.0]
    ros_parameters:
      velodyne_driver_node:
        frame_id: lidar3d_0_laser
        device_ip: 192.168.131.25
        port: 2368
        model: VLP16
      velodyne_transform_node:
        model: VLP16
        fixed_frame: lidar3d_0_laser
        target_frame: lidar3d_0_laser

5 - Launch the simulation with 
`ros2 launch clearpath_gz simulation.launch.py rviz:=true setup_path:=$HOME/clearpath/cp1`

6 - Spawn a robot with

`ros2 launch clearpath_gz robot_spawn.launch.py setup_path:=$HOME/clearpath/cp5`

7- use teleop to drive to drive the robot 5, not working

'ros2 run teleop_twist_keyboard teleop_twist_keyboard cmd_vel:=/a200_0005/cmd_vel'
roni-kreinin commented 5 months ago

See https://github.com/ros-controls/gz_ros2_control/issues/145

Gior26 commented 5 days ago

Ugly workaround but works if you're using multiple instances of the same robot. In clearpath_generator_common/clearpath_generator_common/param/platform.py replace the namespace with "/**" in line 88.

@@ -88,7 +88,7 @@ class PlatformParam():
             # Parameter file to generate
             self.param_file = ParamFile(
                 name=self.parameter,
-                namespace=self.namespace,
+                namespace="/**",
                 path=self.param_path)