예제 #1
0
def read_dac_limit_status_rtn(board_id: int) -> List[DACLimitStatus]:
    p_positive_status = ffi.new('unsigned char *')
    p_negative_status = ffi.new('unsigned char *')
    status = lib.flex_read_dac_rtn(board_id, p_positive_status,
                                   p_negative_status)
    value_high, value_low = p_positive_status[0], p_negative_status[0]
    return status, DACLimitStatus.from_flags(value_high, value_low)
예제 #2
0
def read_error_msg_detail_rtn(board_id: int):
    p_command_id = ffi.new('unsigned short *')
    p_resource_id = ffi.new('unsigned short *')
    p_error_code = ffi.new('int *')
    p_line_number = ffi.new('unsigned short *')
    p_file_number = ffi.new('unsigned short *')
    status = lib.flex_read_error_msg_rtn(board_id, p_command_id, p_resource_id,
                                         p_error_code, p_line_number,
                                         p_file_number)
    return status, (p_command_id[0], p_resource_id[0], p_error_code[0],
                    p_line_number[0], p_file_number[0])
예제 #3
0
def read_error_msg_rtn(board_id: int):
    p_command_id = ffi.new('unsigned short *')
    p_resource_id = ffi.new('unsigned short *')
    p_error_code = ffi.new('int *')
    status = lib.flex_read_error_msg_rtn(board_id, p_command_id, p_resource_id,
                                         p_error_code)
    return status, (
        p_command_id[0],
        p_resource_id[0],
        p_error_code[0],
    )
예제 #4
0
def read_velocity_rtn(board_id: int, which_axis_or_vector_space: int) -> int:
    with ffi.new('int *') as p_velocity:
        status = lib.flex_read_velocity_rtn(board_id,
                                            which_axis_or_vector_space,
                                            p_velocity)
        value = p_velocity[0]
    return status, value
예제 #5
0
def read_follow_error_rtn(board_id: int,
                          which_axis_or_vector_space: int) -> int:
    with ffi.new('short *') as p_following_error:
        status = lib.flex_read_follow_error_rtn(board_id,
                                                which_axis_or_vector_space,
                                                p_following_error)
        value = p_following_error[0]
    return status, value
예제 #6
0
def read_blend_status_rtn(
        board_id: int,
        axis_or_vector_space: AxisOrVectorSpace) -> List[BlendStatus]:
    with ffi.new('unsigned short *') as p_blend_status:
        status = lib.flex_read_blend_status_rtn(board_id,
                                                axis_or_vector_space.value,
                                                p_blend_status)
        value = p_blend_status[0]
    return status, BlendStatus.from_flags(value, axis_or_vector_space)
예제 #7
0
 def into_c(self):
     p_struct = ffi.new('struct PID *')
     _direct_map_fields(
         self, p_struct,
         ['kp', 'ki', 'ilim', 'kd', 'td', 'kv', 'aff', 'vff'])
     return p_struct
예제 #8
0
 def to_c(self):
     p_struct = ffi.new('struct NIMC_DATA *')
     p_struct.longData = self.long_data
     p_struct.boolData = 1 if self.bool_data else 0
     p_struct.doubleData = self.float_data
     return p_struct
예제 #9
0
 def to_c(self):
     p_struct = ffi.new('struct NIMC_CAMMING_ENABLE_DATA *')
     p_struct.axisIndex = self.axis_index
     p_struct.enable = 1 if self.enable else 0
     p_struct.position = self.position
     return p_struct
예제 #10
0
 def to_c(self):
     p_struct = ffi.new('struct REGISTRY *')
     _direct_map_fields(self, p_struct,
                        ['device', 'type', 'pstart', 'size'])
     return p_struct
예제 #11
0
def read_csr_rtn(board_id: int) -> int:
    with ffi.new('unsigned short *') as p_csr:
        status = lib.flex_read_csr_rtn(board_id, p_csr)
        value = p_csr[0]

    return status, value
예제 #12
0
def read_mcs_status_rtn(board_id: int) -> List[MotionStatus]:
    with ffi.new('unsigned short *') as p_motion_complete:
        status = lib.flex_read_mcs_status_rtn(board_id, p_motion_complete)
        value = p_motion_complete[0]
    return status, MotionStatus.from_flags(value)
예제 #13
0
def read_axis_status_rtn(board_id: int, axis: int) -> AxisStatus:
    with ffi.new('unsigned short *') as p_axis_status:
        status = lib.flex_read_axis_status_rtn(board_id, axis, p_axis_status)
        value = p_axis_status[0]
    return status, AxisStatus.from_flags(value)
예제 #14
0
def read_rpm_rtn(board_id: int, axis: int) -> float:
    with ffi.new('double *') as p_rpm:
        status = lib.flex_read_rpm_rtn(board_id, axis, p_rpm)
        value = p_rpm[0]
    return status, value
예제 #15
0
def read_dac_rtn(board_id: int, which_axis_or_dac: int) -> int:
    with ffi.new('short *') as p_dac_output:
        status = lib.flex_read_dac_rtn(board_id, which_axis_or_dac,
                                       p_dac_output)
        value = p_dac_output[0]
    return status, value
예제 #16
0
def read_target_pos_rtn(board_id: int, axis: int) -> int:
    with ffi.new('int *') as p_target_position:
        status = lib.flex_read_target_pos_rtn(board_id, axis,
                                              p_target_position)
        value = p_target_position[0]
    return status, value