I’m writing a controller software in python for my robot and I would like it to interface with industrial_robot_client and simple message. I understand I can use scapy to craft network packets but I’m a little lost on how I should do this? Has anyone done something like this or knows ways I can encode and decode the simple message protocol in python, with scapy for example?
I’m trying to define a custom protocol in scapy but am a little lost.
class simpleMessage_feedback(Packet):
name = "joint feedback"
fields_desc = [ByteEnumField("message_ID", 10),
ByteEnumField("comm_type",1),
ByteEnumField("reply",0 ),
]
I’m not sure any more what the state of it is, nor whether it will work for what you are trying to do, but I wrote gavanderhoorn/simple_message_py a few years back.
There is no assumption in the bare protocol classes about it being a server or a client. Only the top-level (Twisted-based in this case) program that provides the data (coming from a socket, but that is not a requirement) would make that distinction.
The example is a client, but only because the endpoint created is one.
I see. I’ve started trying to get everything working but it seems the construct library has had some significant changes so there’s some work in there. Mind if I open some issues on GitHub or ask some questions?
Would be great to have a server variant of this for both integration testing the simple_message_client in industrial_core and to have at least one readable (ie not obfuscated by robot manufacturer languages) reference server implementation if someone ends up implementing yet another driver
For some reason I didn’t receive any email notifications about this thread. Sorry about that.
The old version of construct is actually still available. It’s just called construct v2. I use it all the time.
I don’t believe you needed to really update anything.
Looking at your fork I’m also not entirely sure why you delete everything and then re-add it. The commit history is rather confusing.
You’re free to ask, always. I can’t guarantee I can help though.
ur_driver is not simple_message based. So that wouldn’t help you.
As @simonschmeisser already commented: the client is waiting for joint state messages, as it cannot otherwise determine what the state of your robot/controller is.
The easiest is to periodically send JOINT_POSITION to the client. If you need/would like multi-group support, you’d have to use JOINT_FEEDBACK (but note that multi-group support never made it into the v1 industrial_robot_client).
By the time I found that out I already had done most of the work anyway, might as well do it. And I’m pretty much learning as I go so my workflow is pretty messy. Sorry about that.
I get that and i’ m now doing that on port 11002. Or should I use JOINT_POSITION instead? And I’ve tried sending ROBOT_STATUS messages to the client on port 11000 but that does nothing. Looking at wireshark the client doesn’t send any requests until I shut it down. Then it sends a single JOINT_TRAJECTORY_POINT type message.
Also I’m using the packages available from melodic repos if that means anything.
I see. I got it mostly working now, messages are sent and decoded correctly. But how do I make a callback for the joint_trajectory_point message? I attached a callback with the registerCallback function and gave a function as callback that sends a reply message using sendMsg but the _dispatchMsg function gets cauhght in the exception? Is this how you’re supposed to do it?
EDIT:
Disregard that, I figured it out and now everything works. It sends callbacks and outputs joint values to an array. ROS complains about execution timeout but that can be disabled.
Now I need to just figure out the motor control bits.