sailboat_main.main_algo.main_algo module

class sailboat_main.main_algo.main_algo.MainAlgo

Bases: Node

The sailing algorithm responsible for changing the rudder angle based on the current location, destination, and heading direction.

calculate_rudder_angle()

The main function for calculating the rudder angle. This function will do nothing if current location is missing, or the boat is tacking but the tacking point is missing, or the current destination is missing (inclusive or). Otherwise, this function will publish the rudder angle, and the rudder angle is from -25 to 25 degree rounded to the nearest 5.

curr_dest_callback(msg)

Use the NavSatFix data to assign value to self.curr_dest

curr_gps_callback(msg)

Use the NavSatFix data to assign value to self.curr_loc

heading_dir_callback(msg)

Use the imu data to assign value to self.heading_dir

sailboat_main.main_algo.main_algo.euler_from_quaternion(x, y, z, w)

This is a helper function. Convert a quaternion into euler angles (roll, pitch, yaw) roll is rotation around x in radians (counterclockwise) pitch is rotation around y in radians (counterclockwise) yaw is rotation around z in radians (counterclockwise)

sailboat_main.main_algo.main_algo.main(args=None)