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]
request(*attributes)[source]

Request one or more attribute from sailsd. These should be the names of each attribute as a string, for example:

>>> sailsd.request('speed')
{'speed': 4.59422737529291
>>> sailsd.request('heading', 'latitude')
{'heading': 0.7459227808181, 'latitude': 0.004578511779640}
set(**kwargs)[source]

Set attributes in sailsd.

>>> sailsd.set(rudder_angle=0.2)
{}
>>> sailsd.set(latitude=0)
{}

The attributes you are likely to be able to set are:

  • latitude
  • longitude
  • sail-angle
  • heading
  • rudder-angle
  • wind-speed
  • wind-angle

but there could be others.

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

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.

update()[source]

Read attributes from sailsd and update values. For example:

>>> wind = sailsd.Wind()
>>> wind.update()
>>> wind.speed
4.0
>>> wind.angle
1.5707963267948966