Skip to content

Commit

Permalink
Merge pull request #26 from clearpathrobotics/rkreinin/mounts
Browse files Browse the repository at this point in the history
Disk and Post mounts
  • Loading branch information
roni-kreinin authored Aug 2, 2023
2 parents d925685 + ca1e571 commit 4457f66
Show file tree
Hide file tree
Showing 13 changed files with 400 additions and 144 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,6 @@ def __init__(self, platform: str, attachment: Structure) -> None:
}

def __new__(cls, platform, attachment: BaseAttachment) -> BaseDescription:
return AttachmentsDescription.MODEL[attachment.ATTACHMENT_MODEL](platform, attachment)
return AttachmentsDescription.MODEL.setdefault(
attachment.ATTACHMENT_MODEL,
AttachmentsDescription.BaseDescription)(platform, attachment)
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ def __init__(self, link: Mesh) -> None:
MODEL = {
Link.BOX: BoxDescription,
Link.CYLINDER: CylinderDescription,
Link.FRAME: BaseDescription,
Link.MESH: MeshDescription,
Link.SPHERE: SphereDescription,
}

def __new__(cls, link: BaseLink) -> BaseDescription:
return LinkDescription.MODEL[link.LINK_TYPE](link)
return LinkDescription.MODEL.setdefault(
link.LINK_TYPE,
LinkDescription.BaseDescription)(link)
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@

from clearpath_config.mounts.types.mount import BaseMount
from clearpath_config.mounts.types.fath_pivot import FathPivot
from clearpath_config.mounts.types.flir_ptu import FlirPTU
from clearpath_config.mounts.types.pacs import PACS
from clearpath_config.mounts.types.post import Post
from clearpath_config.mounts.types.sick import SICKStand

from typing import List

Expand Down Expand Up @@ -104,12 +105,37 @@ def __init__(self, mount: PACS.Bracket) -> None:
self.MODEL: mount.model,
})

class SICKStandDescription(BaseDescription):
MODEL = 'model'

def __init__(self, mount: SICKStand) -> None:
super().__init__(mount)
self.parameters.update({
self.MODEL: mount.model,
})

class PostDescription(BaseDescription):
MODEL = 'model'
SPACING = 'spacing'
HEIGHT = 'height'

def __init__(self, mount: Post) -> None:
super().__init__(mount)
self.parameters.update({
self.MODEL: mount.model,
self.SPACING: mount.spacing,
self.HEIGHT: mount.height
})

MODEL = {
FathPivot.MOUNT_MODEL: FathPivotDescription,
FlirPTU.MOUNT_MODEL: BaseDescription,
PACS.Bracket.MOUNT_MODEL: PACSBracketDescription,
PACS.Riser.MOUNT_MODEL: PACSRiserDescription,
SICKStand.MOUNT_MODEL: SICKStandDescription,
Post.MOUNT_MODEL: PostDescription
}

def __new__(cls, mount: BaseMount) -> BaseDescription:
return MountDescription.MODEL[mount.MOUNT_MODEL](mount)
return MountDescription.MODEL.setdefault(
mount.MOUNT_MODEL,
MountDescription.BaseDescription)(mount)
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@


class PlatformDescription():
class Base():
class BasePlatform():
pkg_clearpath_platform_description = 'clearpath_platform_description'

def __init__(self, model: Platform) -> None:
Expand All @@ -43,10 +43,5 @@ def __init__(self, model: Platform) -> None:
self.macro = self.file
self.path = f'urdf/{model}/'

MODEL = {
Platform.A200: Base,
Platform.J100: Base,
}

def __new__(cls, model: Platform) -> Base:
return PlatformDescription.MODEL[model](model)
def __new__(cls, model: Platform) -> BasePlatform:
return PlatformDescription.BasePlatform(model)
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@
Microstrain,
RedshiftUM7
)
from clearpath_config.sensors.types.gps import (
Garmin18x,
NovatelSmart6,
NovatelSmart7,
SwiftNavDuro
)


from typing import List

Expand Down Expand Up @@ -170,13 +163,11 @@ def __init__(self, sensor: IntelRealsense) -> None:
IntelRealsense.SENSOR_MODEL: IntelRealsenseDescription,
Microstrain.SENSOR_MODEL: ImuDescription,
VelodyneLidar.SENSOR_MODEL: Lidar3dDescription,
SwiftNavDuro.SENSOR_MODEL: BaseDescription,
Garmin18x.SENSOR_MODEL: BaseDescription,
NovatelSmart6.SENSOR_MODEL: BaseDescription,
NovatelSmart7.SENSOR_MODEL: BaseDescription,
CHRoboticsUM6.SENSOR_MODEL: ImuDescription,
RedshiftUM7.SENSOR_MODEL: ImuDescription
}

def __new__(cls, sensor: BaseSensor) -> BaseDescription:
return SensorDescription.MODEL[sensor.SENSOR_MODEL](sensor)
return SensorDescription.MODEL.setdefault(
sensor.SENSOR_MODEL,
SensorDescription.BaseDescription)(sensor)
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,8 @@ def __init__(self,
self.default_parameter_file_path = 'config'

PARAMETER = {
CONTROL: BaseParam,
IMU_FILTER: ImuFilterParam,
LOCALIZATION: LocalizationParam,
TELEOP_INTERACTIVE_MARKERS: BaseParam,
TELEOP_JOY: TeleopJoyParam,
TWIST_MUX: TwistMuxParam,
}
Expand All @@ -180,4 +178,5 @@ def __new__(cls,
parameter: str,
clearpath_config: ClearpathConfig,
param_path: str) -> BaseParam:
return PlatformParam.PARAMETER[parameter](parameter, clearpath_config, param_path)
return PlatformParam.PARAMETER.setdefault(parameter, PlatformParam.BaseParam)(
parameter, clearpath_config, param_path)
Binary file added clearpath_mounts_description/meshes/disk.stl
Binary file not shown.
125 changes: 125 additions & 0 deletions clearpath_mounts_description/meshes/sick_inverted.dae

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:macro name="novatel_smart7_stand" params="name parent_link height:=0.145 *origin">
<robot xmlns:xacro="http://wiki.ros.org/xacro">
<xacro:macro name="disk" params="name parent_link *origin">
<link name="${name}_link">
<visual>
<origin xyz="0 0 ${height/2}" rpy="0 0 0"/>
<material name="dark_grey"/>
<geometry>
<box size="0.045 0.025 ${height}" />
<mesh filename="package://clearpath_mounts_description/meshes/disk.stl" />
</geometry>
<material name="black" />
<origin xyz="0 0 0" rpy="0 0 0" />
</visual>
<collision>
<origin xyz="0 0 ${height/2}" rpy="0 0 0"/>
<geometry>
<box size="0.045 0.025 ${height}" />
<box size="0.104 0.142 0.006" />
</geometry>
<origin xyz="0 0 0.003" rpy="0 0 0" />
</collision>
</link>

<link name="${name}_mount"/>
<link name="${name}_mount" />

<joint name="${name}_joint" type="fixed">
<xacro:insert_block name="origin" />
<parent link="${parent_link}" />
<child link="${name}_link" />
<xacro:insert_block name="origin" />
</joint>

<joint name="${name}_mount_joint" type="fixed">
<origin xyz="0 0 ${height}" />
<parent link="${name}_link" />
<child link="${name}_mount" />
<origin xyz="0 0 0.006" rpy="0 0 0" />
</joint>
</xacro:macro>
</robot>
</robot>
104 changes: 0 additions & 104 deletions clearpath_mounts_description/urdf/pacs/quad_post.urdf.xacro

This file was deleted.

Loading

0 comments on commit 4457f66

Please sign in to comment.