roboball2d package¶
Subpackages¶
Submodules¶
roboball2d.item module¶
-
class
roboball2d.item.
Item
¶ Bases:
object
Data structure for encapsulating the state of various objects.
- position : list of 2 floats
- (x,y) in meters
- angle : float
- in radian
- linear_velocity : list of 2 floats
- (vx,vy) in meters per seconds
- angular_velocity: float
- in radian per second
- torque : float
- measured torque
- desired_torque: float
- desired torque as set by control
- anchor : float
set all attributes values to 0 (or list of zeros)
-
__init__
()¶ set all attributes values to 0 (or list of zeros)
-
anchor
¶
-
angle
¶
-
angular_velocity
¶
-
desired_torque
¶
-
linear_velocity
¶
-
position
¶
-
torque
¶
roboball2d.utils module¶
-
class
roboball2d.utils.
Box
(d, dtype=<class 'numpy.float32'>, shape=None)¶ Bases:
object
Convenience class for creating gym spaces Box from a dictionary : {key:(min value,max value)} Once an instance of Box created, this instance has read/write attributes corresponding to the keys. For example:
d = {"a":(1,2), "b":(-1,1)} box = Box(d) box.a = 1.2 box.b = 0.1
The get_space and get_box methods can be used to get respecively the gym space or the numpy arrays of attributes
- d :
- dictionary of attributes (keys) associated to a tuple of related min and max values
-
__init__
(d, dtype=<class 'numpy.float32'>, shape=None)¶ - d :
- dictionary of attributes (keys) associated to a tuple of related min and max values
-
get_box
()¶ returns the corresponding numpy array
-
get_space
()¶ returns the corresponding gym space
-
roboball2d.utils.
arraytize
(v)¶ convenience function that “transforms” its arguments into a list. If the argument is already a list, returns it. If the argument is None, returns an empty list. Otherwise returns [argument].