1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- """睿手相关参数模型"""
- from enum import Enum
- from pydantic import BaseModel
- from pydantic import Field
- FINGERMODEL_IDS = {
- 'rest': 0,
- 'cylinder': 1,
- 'ball': 2,
- 'flex': 3,
- 'double': 4,
- 'treble': 5
- }
- class ChannelName(int, Enum):
- CHANNEL_A = 0x01
- CHANNEL_B = 0x02
- class DraftChannel(int, Enum):
- SINGLE = 0x01
- DOUBLE = 0x02
- class IsElectric(int, Enum):
- WITH_ELECTRIC = 0x00
- WITHOUT_ELECTRIC = 0x01
- class SetCurrent(BaseModel):
- """set current pydantic model"""
- channel: ChannelName = Field(
- ...,
- description=
- "set peripheral hand current channel (channelA: 0x01, channelB: 0x02)")
- value: int = Field(...,
- le=255,
- ge=0,
- description="set peripheral hand current value")
- class ControlMotion(BaseModel):
- """control motion pydantic model"""
- hand_select: str = Field()
- thumb: int = Field(..., le=100, ge=0)
- index_finger: int = Field(..., le=100, ge=0)
- middle_finger: int = Field(..., le=100, ge=0)
- ring_finger: int = Field(..., le=100, ge=0)
- little_finger: int = Field(..., le=100, ge=0)
- duration: int = Field(..., le=20, ge=5)
- class DraftingAction(BaseModel):
- """drafting action pydantic model"""
- hand_select: str = Field(
- ...,
- description="select control hand (double: 0x01, left: 0x02, right:0x03)"
- )
- is_electric: IsElectric = Field(
- ..., description="model (with electric: 0x00, without electric: 0x01)")
- draft_channel: DraftChannel = Field(
- ..., description="select channel (a channel: 0x01, double: 0x02)")
- a_channel_value: int = Field(...,
- le=255,
- ge=0,
- description="set A channel hand current value")
- b_channel_value: int = Field(...,
- le=255,
- ge=0,
- description="set b channel hand current value")
- duration: int = Field(..., le=20, ge=5)
|