Azizjon Posted September 10 Posted September 10 Dears, I would like to read data from Omron TMFlow for cobot TM5-900 using python. If someone tried to obtain data like x,y,z positions, could you please share the code? This is my code, where I have connected, but the Y position shows 0.0 . How can I get the data by connecting modbus tcp. from pymodbus.client import ModbusTcpClient import struct # Define the IP and port of the Omron TM robot ROBOT_IP = '192.168.81.164' # Replace with your robot's IP address PORT = 502 # Standard Modbus TCP port # Initialize the Modbus client client = ModbusTcpClient(ROBOT_IP, port=PORT) # Connect to the Modbus server client.connect() # Example: Reading the Y position from two holding registers # Replace `100` with the actual starting address for the Y position start_register_address = 7003 # Starting address of the holding register for Y position response = client.read_holding_registers(start_register_address, 10) # Check if the response is valid and process the Y position value if not response.isError(): # Combine the two registers into a 32-bit float (little-endian format) registers = response.registers y_position = struct.unpack('<f', struct.pack('<HH', registers[0], registers[1]))[0] print(f"Y Position: {y_position}") else: print(f"Error reading Y position: {response}") # Disconnect when done client.close() Quote
Troy Shaw Posted November 18 Posted November 18 This Omron Forum currently only includes Barcode/Machine Vision (previously Microscan). For other Omron products please contact Omron’s main Technical Support by email at “ia.techsupport@omron.com”. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.