Beispiel #1
0
#------------------Initial values -----------------

#for speeds and postition calculations
max_speed = 12 * 2 * pi
last_raw_angle = 0.
raw_angle = 0.
angle = 0.
rads = 0.

value = 33
cmd_speed = 0.0

stm32_1 = motor_position()
stm32_2 = motor_position()
motor = motor_tools()

while True:

    #-------------------Confirming stm32_1_position from yarp bottles-----------

    stm32_1 = motor.checking_motor_position('1', stm32_1, in_1, in_1_name)
    stm32_2 = motor.checking_motor_position('2', stm32_2, in_2, in_2_name)

    #------------Connecting to the serial port---------------------

    #initial connection
    motor.connecting_to_stm32(3, stm32_1.serial, stm32_2.serial, 0, 0)

    #-----------------------------
    try:
Beispiel #2
0
last_raw_angle=0.
raw_angle=0.
angle=0.
rads=0.

value=33
cmd_speed=0.0

#for serial port
stm32_position='0'
serial_device_counter=0
connected=False



motor=motor_tools()


while True:
    
    #------------Connecting to the serial port---------------------
    motor.connecting_to_stm32(1,0,0,0,0)

    #-----------------------------
    try:
   
        while motor.connected==True:

            motor.serial_port_communication(motor,cmd_speed,value)
            
            #-----------connected to STM32 1----------