Welcome to python-sailsd’s documentation!¶
python-sailsd is a python library to make interacting with the sailsd API easy.
To install:
$ pip install python-sailsd
Brief API overview¶
-
class
sailsd.
Sailsd
(host='localhost', port=3333)[source]¶
-
class
sailsd.
Boat
(sailsd=None, auto_update=False)[source]¶ A merry sailing boat sailing on the seas.
Parameters: - sailsd – an instance of
sailsd.Sailsd
to use instead of creating a new instance - auto_update (bool) – whether to automatically request updated values on each
attribute request. Setting this to True makes using
update()
redundant.
Some example usage:
>>> boat = sailsd.Boat() >>> boat.rudder_angle = 0.1 >>> boat.update() >>> boat.heading 0.758290214606183 >>> boat.speed 4.6089232392605135 >>> boat.latitude, boat.longitude (0.0009904288095353697, 0.0009966210180718897)
-
heading
¶ Current heading of the boat, measured in radians from the bow
-
latitude
¶ Current latitude of the boat
-
longitude
¶ Current longitude of the boat
-
rudder_angle
¶ Angle of the rudder, measured in radians where 0 is a straight rudder
-
sail_angle
¶ Angle of the sail, measured in radians where 0 is the sail pulled to the exact center of the boat
-
sheet_length
¶ length of the sheet, between 0 and 1
-
speed
¶ Current speed of the boat, measured in meters per second
-
update
()[source]¶ Read attributes from sailsd and update all values. For example:
>>> boat = sailsd.Boat() >>> boat.update() >>> boat.latitude 100.00292426652119
This should be run just before reading values to ensure they are up to date.
-
x
¶ Longitude approximately projected to an x y meter grid
-
y
¶ Latitude approximately projected to an x y meter grid
- sailsd – an instance of
-
class
sailsd.
Wind
(sailsd=None, auto_update=False)[source]¶ Some wind wafting over the sea.
Parameters: - sailsd – an instance of
sailsd.Sailsd
to use instead of creating a new instance - auto_update (bool) – whether to automatically request updated values on each
attribute request. Setting this to True makes using
update()
redundant.
-
angle
¶ Angle of wind direction in radians. A value of 0 is a movement of wind from north to south.
-
speed
¶ Speed of wind in meters per second.
- sailsd – an instance of