Skip to content

Commit 920aa01

Browse files
committed
Add licenses
1 parent ce19ae0 commit 920aa01

File tree

5 files changed

+93
-7
lines changed

5 files changed

+93
-7
lines changed

external_samples/color_range_sensor.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
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 color/range sensor
17+
# @author [email protected] (Alan Smith)
18+
119
from component import Component, PortType, InvalidPortException
220
from collections.abc import Protocol
321

@@ -9,7 +27,6 @@ def __call__(self, hue : int, saturation : int, value : int) -> None:
927
pass
1028

1129
class ColorRangeSensor(Component):
12-
# Required methods
1330
def __init__(self, ports : list[tuple[PortType, int]]):
1431
portType, port = ports[0]
1532
if portType != PortType.I2C_PORT:

external_samples/component.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
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 an abstract class for all components
17+
# @author [email protected] (Alan Smith)
18+
119
from abc import ABC, abstractmethod
220
from enum import Enum
321
from collections.abc import Protocol

external_samples/rev_touch_sensor.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
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 touch sensor
17+
# @author [email protected] (Alan Smith)
18+
119
from component import Component, PortType, InvalidPortException, EmptyCallable
220

321
class RevTouchSensor(Component):
@@ -7,7 +25,6 @@ def __init__(self, ports : list[tuple[PortType, int]]):
725
if portType != PortType.SMART_IO_PORT:
826
raise InvalidPortException
927
self.port = port
10-
# Required methods
1128
def get_manufacturer(self) -> str:
1229
return "REV Robotics"
1330
def get_name(self) -> str:

external_samples/servo.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
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 servo
17+
# @author [email protected] (Alan Smith)
18+
119
from component import Component, PortType, InvalidPortException
220

321
class Servo(Component):
4-
# Required methods
522
def __init__(self, ports : list[tuple[PortType, int]]):
623
portType, port = ports[0]
724
if portType != PortType.SERVO_PORT:

external_samples/smart_motor.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
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)
118
from component import Component, PortType, InvalidPortException
219

320
class SmartMotor(Component):
4-
# Required methods
521
def __init__(self, ports : list[tuple[PortType, int]]):
622
portType, port = ports[0]
723
if portType != PortType.SMART_MOTOR_PORT:
@@ -30,11 +46,12 @@ def periodic(self) -> None:
3046
# Component specific methods
3147
def set_speed(self, speed: float) -> None:
3248
'''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
3451

3552
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
3855

3956
def get_num_relative_encoder_ticks(self) -> int:
4057
'''Get the number of relative motor ticks since reset of encoder'''

0 commit comments

Comments
 (0)