Stream Joint Positions from a C++ file to Grasshopper in Rhino 7

66 Views Asked by At

I am currently developing a simulator for a Kuka robot in Grasshopper. To accomplish this, I would like to continuously send joint positions from a C++ file to Grasshopper which in turn would make the loaded Kuka robot move continuously to the incoming joint positions in the simulation. Conversely, I would also like to continuously send joint positions from Grasshopper to a C++ file.

Currently, I have successfully managed to load a Kuka robot and make it move to particular joint positions within grasshopper using the robots plugin.

To stream joint positions from a C++ file to Grasshopper, the idea I had was to create a upd server script in C++ which would continuously send these joint positions. However, I am not sure how to go about creating a Udp client within Grasshopper itself which would continuously receive the message the server is sending.

Could anyone help me with this?

1

There are 1 best solutions below

0
urbancomputing207 On

You may not need to work with C++ for receiving and sending UDP on the grasshopper side if you have a working UDP Server transmitting position.

If you have a UDP server set up to send messages, you can use the ‘Fire Fly’ plugin’s ‘UDP Listener’ component to subscribe to your server. You can use it in conjunction with the ‘UDP Sender’ component for two-way communications.

Here is a snip of the Fire Fly user guide for these two components.

enter image description here

Here is a link to download the Plugin, UDP Examples, and User Guide: Firefly on Food4Rhino

Here is a link to additional documentation: https://grasshopperdocs.com/addons/firefly.html

Here is a existing discussion on how to implement C++ code within grasshopper:Mcneel Discourse Discussion