python_scripts/mainProg.py
def semi_active_mode(activationCode):
    ''' 
    Semi active-strength exercise
        Constructing Admittance haptic system difference equation for
        ASSISTED resistance training.

        Args:
            activationCode [str]: activation string to determine which damper_spring 
                                  system to be used in the admittance system.
    '''
    stopCondition = False
    assist_level = assistive_constants(activationCode[1]) # assign assistive level of machine
    damper_spring = admittance1_constants(activationCode[2]) # assign which damper-spring system
    sysModel = admittance_type(damper_spring, freqSample) # initialize dynamic system model
    sysModel.set_initial_position(round(distance_sensor.distance*1000, 0))
    sysModel.set_force_window(weightMeanWindow)

    while not stopCondition:
        start_loop = time.time()
        sysModel_n = spf.haptic_rendering(sysModel, force_sensor) # Output system @ latest state
        spf.command_actuator(sysModel_n) # send command to actuator
        
        # this time library attempts to make the system sampling frequency
        # consistent at about "freqSample"
        command = spf.serial_routine(ser_command)
        time.sleep(abs(sample_period - ((time.time()-start_loop)%sample_period)))
        if command == "-s":
            stopCondition = True
 
    Semi active-strength exercise
        Constructing Admittance haptic system difference equation for
        ASSISTED resistance training.

        Args:
            activationCode [str]: activation string to determine which damper_spring 
                                  system to be used in the admittance system.
    
Semi active-strength exercise
Constructing Admittance haptic system difference equation for
ASSISTED resistance training.

activationCode [str]: activation string to determine which damper_spring
system to be used in the admittance system.
Semi active - strength exercise Constructing Admittance haptic system difference equation for ASSISTED resistance training . activationCode [ str ] : activation string to determine which damper_spring system to be used in the admittance system .
def semi_active_mode(activationCode):
    stopCondition = False
    assist_level = assistive_constants(activationCode[1]) 
    damper_spring = admittance1_constants(activationCode[2]) 
    sysModel = admittance_type(damper_spring, freqSample) 
    sysModel.set_initial_position(round(distance_sensor.distance*1000, 0))
    sysModel.set_force_window(weightMeanWindow)
    while not stopCondition:
        start_loop = time.time()
        sysModel_n = spf.haptic_rendering(sysModel, force_sensor) 
        spf.command_actuator(sysModel_n) 
        command = spf.serial_routine(ser_command)
        time.sleep(abs(sample_period - ((time.time()-start_loop)%sample_period)))
        if command == "-s":
            stopCondition = True
def semi_active_mode ( activationCode ) : stopCondition = False assist_level = assistive_constants ( activationCode [ 1 ] ) damper_spring = admittance1_constants ( activationCode [ 2 ] ) sysModel = admittance_type ( damper_spring , freqSample ) sysModel . set_initial_position ( round ( distance_sensor . distance * 1000 , 0 ) ) sysModel . set_force_window ( weightMeanWindow ) while not stopCondition : start_loop = time . time ( ) sysModel_n = spf . haptic_rendering ( sysModel , force_sensor ) spf . command_actuator ( sysModel_n ) command = spf . serial_routine ( ser_command ) time . sleep ( abs ( sample_period - ( ( time . time ( ) - start_loop ) % sample_period ) ) ) if command == "-s" : stopCondition = True
Semi active-strength exercise
Constructing Admittance haptic system difference equation for
ASSISTED resistance training.
Semi active - strength exercise Constructing Admittance haptic system difference equation for ASSISTED resistance training .
''' 
    Semi active-strength exercise
        Constructing Admittance haptic system difference equation for
        ASSISTED resistance training.

        Args:
            activationCode [str]: activation string to determine which damper_spring 
                                  system to be used in the admittance system.
    ''' # assign assistive level of machine # assign which damper-spring system # initialize dynamic system model # Output system @ latest state # send command to actuator # this time library attempts to make the system sampling frequency # consistent at about "freqSample"
activationCode