Example #1
0
 def encode_camera_index(self, camera_index):
     """
     PURPOSE: Encodes the camera index as a single C Character Byte represented as a Python String
     INPUTS: camera_index = The camera index to be encoded
     OUTPUTS: encoded_byte = The camera index as a single Byte represented as a Python String
     """
     encoded_byte = ctb.char_pack(camera_index)
     return encoded_byte
Example #2
0
 def encode_levelling_motor_flag(self):
     """
     PURPOSE: Encodes the levelling motor rotation direction and speed as a single C Character Byte represented as a Python String
     INPUTS: NONE
     OUTPUTS: encoded_byte = The levelling motor rotation and speed as a single Byte represented as a Python String
     """
     encoded_byte = ctb.char_pack(self.levelling_motor_flag)
     return encoded_byte
Example #3
0
 def encode_inflate_mech_state(self):
     """
     PURPOSE: Encodes the inflation mechanism state into a single C Character Byte represented as a Python String
     INPUTS: NONE
     OUTPUTS: encoded_byte = The inflation mechanism state as a single Byte represnted as a Python String
     """
     encoded_byte = ctb.char_pack(self.inflate_mechanism_state)
     return encoded_byte
Example #4
0
 def encode_grabber_position(self):
     """
     PURPOSE: Encodes the grabber position into a single C Character Byte represented as a Python String
     INPUTS: NONE
     OUTPUTS: encoded_byte = The grabber position as a single Byte represented as a Python String
     """
     encoded_byte = ctb.char_pack(self.grabber_val)
     return encoded_byte
Example #5
0
 def encode_release_mech_flags(self):
     """
     PURPOSE: Encodes the release mechanism state flags as a single C Character Byte represented as a Python String
     INPUTS: NONE
     OUTPUTS: encoded_byte = The release mechanism flags encoded as a single Byte represented as a Python String
     """
     encoded_byte = 0
     num_flags = len(self.release_mechanism_states) - 1
     
     #Converting the flags list into an Integer containing the Flags in the Same Order [0, 1, 1] ==> 011
     for index, stabilisation_flag in enumerate(self.release_mechanism_states):
         index = num_flags - index
         encoded_byte |= (stabilisation_flag << index)
     
     #Packing the Python Integer into a C Char
     encoded_byte = ctb.char_pack(encoded_byte)
     return encoded_byte