Initial code with Python stubs for Lego Spike API, Go Robot Code and an example how to structure our code
This commit is contained in:
commit
a58ba5fd6d
18 changed files with 4561 additions and 0 deletions
1839
spike/__init__.py
Normal file
1839
spike/__init__.py
Normal file
File diff suppressed because it is too large
Load diff
103
spike/control.py
Normal file
103
spike/control.py
Normal file
|
@ -0,0 +1,103 @@
|
|||
def wait_for_seconds(seconds):
|
||||
"""
|
||||
Waits for a specified number of seconds before continuing the program.
|
||||
|
||||
Parameters
|
||||
--------------
|
||||
seconds : The time to wait in seconds.
|
||||
|
||||
Type : float (decimal value)
|
||||
|
||||
Values : any value
|
||||
|
||||
Default : no default value
|
||||
|
||||
Errors
|
||||
----------------
|
||||
TypeError : seconds is not a number.
|
||||
|
||||
ValueError : seconds is not at least 0.
|
||||
"""
|
||||
pass
|
||||
|
||||
def wait_until(get_value_function, operator_function, target_value=True):
|
||||
"""
|
||||
Waits until the condition is True before continuing with the program.
|
||||
|
||||
Parameters
|
||||
--------------
|
||||
get_value_function
|
||||
|
||||
Type : callable function
|
||||
|
||||
Values : A function that returns the current value to be compared to the target value.
|
||||
|
||||
Default : no default value
|
||||
|
||||
operator_function
|
||||
|
||||
Type : callable function
|
||||
|
||||
Values : A function that compares two arguments. The first argument will be the result of get_value_function() and the second argument will be target_value. The function will compare these two values and return the result.
|
||||
|
||||
Default : no default value
|
||||
|
||||
target_value
|
||||
|
||||
Type : any type
|
||||
|
||||
Values : Any object that can be compared by operator_function.
|
||||
|
||||
Default : no default value
|
||||
|
||||
Errors
|
||||
----------------
|
||||
TypeError : get_value_function or operator_function is not callable or operator_function does not compare two arguments.
|
||||
"""
|
||||
pass
|
||||
|
||||
def greater_than(a, b):
|
||||
"""
|
||||
Tests whether value a is greater than value b.
|
||||
This is the same as a > b.
|
||||
|
||||
Parameters
|
||||
---------
|
||||
a : Any object that can be compared to b.
|
||||
|
||||
Type : any type
|
||||
|
||||
Values : any value
|
||||
|
||||
Default : no default value
|
||||
|
||||
b : Any object that can be compared to a.
|
||||
|
||||
Type : any type
|
||||
|
||||
Values : any value
|
||||
|
||||
Default : no default value
|
||||
|
||||
Returns
|
||||
---------
|
||||
Type : boolean
|
||||
|
||||
Values : True if a > b, otherwise False.
|
||||
"""
|
||||
pass
|
||||
|
||||
class Timer:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def reset(self):
|
||||
"""
|
||||
Sets the Timer to "0."
|
||||
"""
|
||||
pass
|
||||
def now(self):
|
||||
"""
|
||||
Retrieves the "right now" time of the Timer
|
||||
"""
|
||||
pass
|
Loading…
Add table
Add a link
Reference in a new issue