clearpathrobotics / clearpath_common

BSD 3-Clause "New" or "Revised" License
14 stars 20 forks source link

Generic Description #37

Closed luis-camero closed 9 months ago

luis-camero commented 10 months ago

There's some "hacky" changes to get things to work with the generic robot.

In the description generator, I had to create a common section:

    def generate_common(self) -> None:
        self.xacro_writer.write_comment('Common')
        if self.clearpath_config.get_platform_model() != Platform.GENERIC:
            # Clearpath Common Materials
            self.xacro_writer.write_include(
                package=self.pkg_clearpath_platform_description.get_name(),
                file='common',
                path='urdf/')
        # Generic Gazebo Controller
        self.xacro_writer.write_include(
            package=self.pkg_clearpath_platform_description.get_name(),
            file='gazebo',
            path='urdf/generic/',
        )

Our Clearpath common materials only get added if using a Clearpath platform; this has repercussions because our sensors and mounts use materials found here. A good solution would be to namespace these materials so they do not interfere with the materials the generic robot may define.

To test this, clone: https://github.com/iRobotEducation/create3_sim and switch to the clearpath_config to the lcamero/generic branch. And use the following robot.yaml to call ros2 launch clearpath_viz view_model.launch.py:

serial_number: generic
version: 0
system:
  ros2:
    namespace: generic
platform:
  description:
    package: irobot_create_description
    path: urdf/create3.urdf.xacro
  control:
    package: irobot_create_control
    path: config/control.yaml
  controller: ps4
  extras:
    urdf: null
    ros_parameters:
      platform_velocity_controller:
        linear.x.max_velocity": 3.0
        linear.x.min_velocity": -3.0
        linear.x.max_acceleration": 6.0
        linear.x.min_acceleration": -6.0
        angular.z.max_velocity": 5.0
        angular.z.min_velocity": -5.0
        angular.z.max_acceleration": 10.0
        angular.z.min_acceleration": -10.0
links:
  box:
    - name: plate
      parent: top_link
      xyz: [0.0, 0.0, 0.1]
      size: [0.1, 0.1, 0.005]
  cylinder:
    - name: leg_01
      parent: top_link
      xyz: [-0.04, -0.04, 0.05]
      rpy: [0.0, 0.0, 0.0]
      radius: 0.004
      length: 0.1
    - name: leg_02
      parent: top_link
      xyz: [-0.04, 0.04, 0.05]
      rpy: [0.0, 0.0, 0.0]
      radius: 0.004
      length: 0.1
    - name: leg_03
      parent: top_link
      xyz: [0.04, -0.04, 0.05]
      rpy: [0.0, 0.0, 0.0]
      radius: 0.004
      length: 0.1
    - name: leg_04
      parent: top_link
      xyz: [0.04, 0.04, 0.05]
      rpy: [0.0, 0.0, 0.0]
      radius: 0.004
      length: 0.1
  frame:
    - name: top
      parent: base_link
      xyz: [0.0, 0.0, 0.09]
      rpy: [0.0, 0.0, 0.0]
  mesh: []
  sphere: []
mounts:
  fath_pivot:
    - parent: plate_link
      xyz: [0.0, 0.0, 0.005]
      rpy: [0.0, 0.0, 0.0]
      angle: 0.0
  riser: []
  disk: []
  post: []
sensors:
  camera:
    - model: intel_realsense
      parent: fath_pivot_0_mount
  lidar2d:
    - model: hokuyo_ust
      parent: top_link
      xyz: [0.0, 0.0, 0.0]