|
| 1 | +# @license |
| 2 | +# Copyright 2025 Porpoiseful LLC |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +# @fileoverview This is a sample for a smart motor |
| 17 | +# @author [email protected] (Alan Smith) |
1 | 18 | from component import Component, PortType, InvalidPortException |
2 | 19 |
|
3 | 20 | class SmartMotor(Component): |
4 | | - # Required methods |
5 | 21 | def __init__(self, ports : list[tuple[PortType, int]]): |
6 | 22 | portType, port = ports[0] |
7 | 23 | if portType != PortType.SMART_MOTOR_PORT: |
@@ -30,11 +46,12 @@ def periodic(self) -> None: |
30 | 46 | # Component specific methods |
31 | 47 | def set_speed(self, speed: float) -> None: |
32 | 48 | '''Set the motor to a speed between -1 and 1''' |
33 | | - # sends to the hardware the speed of the motor |
| 49 | + # TODO: send to the hardware the speed of the motor |
| 50 | + pass |
34 | 51 |
|
35 | 52 | def set_angle_degrees(self, angle: float) -> None: |
36 | | - '''Set the motor to an angle between 0 and 270''' |
37 | | - self.set_position(angle / 270.0) |
| 53 | + '''Set the motor to an angle between 0 and 360''' |
| 54 | + pass |
38 | 55 |
|
39 | 56 | def get_num_relative_encoder_ticks(self) -> int: |
40 | 57 | '''Get the number of relative motor ticks since reset of encoder''' |
|
0 commit comments