DoF - a Robotiq Community
Warning sign
The Dof Community was shut down in June 2023. This is a read-only archive.
If you have questions about Robotiq products please reach our support team.
Tr1peiro

When the server receives the read request what is it returning the to the robot and how is the data wrapped?  What is an example of the return value the server is sending?

the code i use on the robot is the following down

def test2():
    flag = False
    sync_flag = False
    
    open = False
    while(open == False):
        open = socket_open("192.168.1.6",5050)
    end
    
    # popup("Connected to server!")
    while (sync_flag != True):
        data = socket_read_ascii_float(6)
        if (data[1] == 1):
            flag = True
        end
    end
    socket_close()
    flag = False

end
test2()


but he can't read the information i send in the PC to the interface's robot.


Tr1peiro

What is an example of the return from the PC server? If its not configured correctly the robot will not receive it.  That is why I asked to see the return value

The code on pc server is write in that way:

"import socket
from struct import pack

#Variaveis
S = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
IP = "192.168.1.6"
PORTA =  5050
FORMAT = "utf-8"

server_address = (IP, PORTA)
S.bind(server_address)
S.listen(5)

connection, client_address = S.accept()
val = pack('i!', 4)

#Escolha das coordenadas
waypoint1 = input('Inserir coordenadas: ' + "\n")
waypoint2 = input('Inserir coordenadas: ' + "\n")
waypoint3 = input('Inserir coordenadas: ' + "\n")
waypoint4 = input('Inserir coordenadas: ' + "\n")
Ligar = input('Enviar coordenadas e ligaar Servidor? ')


#Decidir se conecto ao servidor ou não
if Ligar == ('yes' or 'Y'):
   connection.send(val)
   S.send(waypoint1.encode())
   S.send(waypoint2.encode())
   S.send(waypoint3.encode())
   S.send(waypoint4.encode())
       
elif Ligar == ('no' or 'N'):
    connection.close()
    
else:
    print("tenta outra vez")
    
connection.close()"

Tr1peiro

Have you tried using a socket test program to send the request and see what value that server returns.  Also, the robot has a timeout of 2 seconds on the read value so if you are waiting for the robot to send a request and then typing the values back you are probably timing out on the robot read
I also test in SocketTest and sending the coordinates and work fine....

My big trouble now is how i write the socket to connect the machine to the PC.....

In the first time i create one simple code without the while loop but  this code doesn't work.....

# def prog():
#     open = socket_open("192.168.1.7", 5050)
#     movel(Plane_1, accel_mss, speed_ms, 0,0)
#     sendToServer = 'Coordenadas: '
#     socket_send_string(sendToServer)
#     data_1 = socket_read_byte_list(8)
#     if data[0]=8
# prog()