utils
Package¶
-
class
pypot.utils.
Point2D
(x, y)¶ Bases:
tuple
Create new instance of Point2D(x, y)
-
x
¶ Alias for field number 0
-
y
¶ Alias for field number 1
-
-
class
pypot.utils.
Point3D
(x, y, z)¶ Bases:
tuple
Create new instance of Point3D(x, y, z)
-
x
¶ Alias for field number 0
-
y
¶ Alias for field number 1
-
z
¶ Alias for field number 2
-
-
pypot.utils.
Point
¶ alias of
pypot.utils.Point3D
-
class
pypot.utils.
Vector3D
(x, y, z)¶ Bases:
tuple
Create new instance of Vector3D(x, y, z)
-
x
¶ Alias for field number 0
-
y
¶ Alias for field number 1
-
z
¶ Alias for field number 2
-
-
pypot.utils.
Vector
¶ alias of
pypot.utils.Vector3D
-
class
pypot.utils.
Quaternion
(x, y, z, w)¶ Bases:
tuple
Create new instance of Quaternion(x, y, z, w)
-
w
¶ Alias for field number 3
-
x
¶ Alias for field number 0
-
y
¶ Alias for field number 1
-
z
¶ Alias for field number 2
-
stoppablethread
Module¶
-
class
pypot.utils.stoppablethread.
StoppableThread
(setup=None, target=None, teardown=None)[source]¶ Bases:
object
Stoppable version of python Thread.
- This class provides the following mechanism on top of “classical” python Thread:
- you can stop the thread (if you defined your run method accordingly).
- you can restart a thread (stop it and re-run it)
- you can pause/resume a thread
Warning
It is up to the subclass to correctly respond to the stop, pause/resume signals (see
run()
for details).Parameters: - setup (func) – specific setup function to use (otherwise self.setup)
- target (func) – specific target function to use (otherwise self.run)
- teardown (func) – specific teardown function to use (otherwise self.teardown)
-
start
()[source]¶ Start the run method as a new thread.
It will first stop the thread if it is already running.
-
stop
(wait=True)[source]¶ Stop the thread.
More precisely, sends the stopping signal to the thread. It is then up to the run method to correctly responds.
-
running
¶ Whether the thread is running.
-
started
¶ Whether the thread has been started.
-
run
()[source]¶ Run method of the thread.
Note
In order to be stoppable (resp. pausable), this method has to check the running property - as often as possible to improve responsivness - and terminate when
should_stop()
(resp.should_pause()
) becomes True. For instance:while self.should_stop(): do_atom_work() ...
-
paused
¶
-
pypot.utils.stoppablethread.
make_update_loop
(thread, update_func)[source]¶ Makes a run loop which calls an update function at a predefined frequency.
-
class
pypot.utils.stoppablethread.
StoppableLoopThread
(frequency, update=None)[source]¶ Bases:
pypot.utils.stoppablethread.StoppableThread
LoopThread calling an update method at a pre-defined frequency.
Note
This class does not mean to be accurate. The given frequency will be approximately followed - depending for instance on CPU load - and only reached if the update method takes less time than the chosen loop period.
Params float frequency: called frequency of the update()
method
trajectory
Module¶
-
class
pypot.utils.trajectory.
MinimumJerkTrajectory
(initial, final, duration, init_vel=0.0, init_acc=0.0, final_vel=0.0, final_acc=0.0)[source]¶ Bases:
object
-
class
pypot.utils.trajectory.
GotoMinJerk
(motor, position, duration, frequency=50)[source]¶ Bases:
pypot.utils.stoppablethread.StoppableLoopThread
-
elapsed_time
¶
-