sharpbrick / powered-up

.NET implementation of the LEGO PoweredUp Protocol
MIT License
98 stars 19 forks source link

add Technic Medium Angular Motor Grey (mindstorms set 51515) #110

Closed rickjansen-dev closed 3 years ago

rickjansen-dev commented 3 years ago

added this motor, it does however behave differently compared to the large technic angular motor, GotoRealZeroAsync() does something different (it stays in the same spot, you can hear the motor whine slightly though, unsure if it is unable to move because power is too low or that it is actually not moving because it is in the 'correct' spot already) see also #75

tthiery commented 3 years ago

Can you add here an output of the poweredup device list -p <whatever> for the TechnicMediumAngularMotor. These allow me to do some analysis without having the actual records (or otherwise build a tool to decompile the StaticPortData ;))

rickjansen-dev commented 3 years ago

device list output for good measure:

Selected TechnicMediumHub with key 1
Discover Ports. Receiving Messages ...
........................................................................................................................................................................
Discover Ports Function: 167 / 167
Hub: 0
  Port: 1
    IOTypeId: TechnicMediumAngularMotorGrey
    HardwareRevision: 0.0.0.4
    SoftwareRevision: 1.0.0.0
    OutputCapability: True
    InputCapability: True
    LogicalCombinableCapability: True
    LogicalSynchronizableCapability: True
    ModeCombinations: [0000000000001110]
    UsedCombinationIndex: 0
    MultiUpdateEnabled: False
    ConfiguredModeDataSetIndex: []
    Mode: 0
      Name: POWER
      IsInput: False
      IsOutput: True
      RawMin: -100
      RawMax: 100
      PctMin: -100
      PctMax: 100
      SIMin: -100
      SIMax: 100
      Symbol: PCT
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: False
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: True
      OutputAbsolute: True
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: SByte
      TotalFigures: 4
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 1
      Name: SPEED
      IsInput: True
      IsOutput: True
      RawMin: -100
      RawMax: 100
      PctMin: -100
      PctMax: 100
      SIMin: -100
      SIMax: 100
      Symbol: PCT
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: True
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: True
      OutputAbsolute: True
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: SByte
      TotalFigures: 4
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 2
      Name: POS
      IsInput: True
      IsOutput: True
      RawMin: -360
      RawMax: 360
      PctMin: -100
      PctMax: 100
      SIMin: -360
      SIMax: 360
      Symbol: DEG
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: False
      InputRelative: True
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: True
      OutputAbsolute: False
      OutputRelative: True
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: Int32
      TotalFigures: 11
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 3
      Name: APOS
      IsInput: True
      IsOutput: True
      RawMin: -180
      RawMax: 179
      PctMin: -200
      PctMax: 200
      SIMin: -180
      SIMax: 179
      Symbol: DEG
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: True
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: True
      OutputAbsolute: True
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: Int16
      TotalFigures: 3
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 4
      Name: CALIB
      IsInput: False
      IsOutput: False
      RawMin: 0
      RawMax: 3600
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 3600
      Symbol: CAL
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: False
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 2
      DatasetType: Int16
      TotalFigures: 5
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 5
      Name: STATS
      IsInput: False
      IsOutput: False
      RawMin: 0
      RawMax: 65535
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 65535
      Symbol: MIN
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: False
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 14
      DatasetType: Int16
      TotalFigures: 5
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
tthiery commented 3 years ago

Mmmh ... Do not like that. Have you tried the test pattern once or multiple times? Try to check out if GotoRealZero is a stable function from its implementation perspective.

rickjansen-dev commented 3 years ago

I tested this a couple of times.. I'll do some more testing side-by-side, executing the same things on both devices on a single hub. I'll look into GotoRealZero if I have some time.

rickjansen-dev commented 3 years ago

I investigated this, and the low speed (5) is the cause of the GotoRealZero not working. If I changed this to 10, it works, and returns to the marked position correctly. At 5 it does not move at all (whereas the technic large angular motor does)

Now simply changing the speed to 10 works, but maybe this (or a minimum speed value) should be parameterized so different absolutemotor's can a specific minimum required to actually move the motor. What do you think @tthiery ?

tthiery commented 3 years ago

Awesome investigation. Thanks.

I will merge this.

Regards the minimum speed: File a issue. Let us park this. Enough stuff to finish up right now.