From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using LabVIEW to control an object in Blender/ importing an object from Blender and controlling it in LabVIEW

Hi, 

 

I'm just trying to start a new aspect to my project whereby I would control a 3D graphic of a human character using inertial and magnetic sensors. 

 

2 potential options I am considering are to create the character in blender, import it to labview (.stl, .dae or any other suggestions?) and control it from there using my 3D orientation algorithms. Has anybody done anything like this?

 

OR

 

Export the 3D orientation data to blender perhaps using UDP sockets or any other suggested technique anybody has(?) and then control the orientation of the bones of a 'rigged' character.

 

So basically if anybody has any experience of controlling a 3D graphic with LabVIEW data all help would be appreciated, better again if it was using Blender! Thanks in advance Smiley Tongue

0 Kudos
Message 1 of 5
(3,682 Views)

Looks like an interesting project. I don't have experience with either of your suggestions, but I think the second one is more practical. My understanding is that the 3D display in LV isn't that great (although I don't have actual experience with it). The only modification I would make is to use TCP instead of UDP, which seems to make a lot more sense.

 

I'm assuming there should be quite a few examples online for how to write Python code in Blender to receive external commands and translate them to something in your blender scene (movement, in your case) and then you simply have to write the corresponding code on the LV side and make sure the protocols match. I would suggest you create a simple ASCII protocol. One thing to note about TCP protocols is that it's useful to have the beginning of the message encode the length of the rest of the message (let's say the first 4 bytes to encode a U32 number). That way, you read N bytes for the length and then know exactly how many bytes you have to read for the rest of the message.


___________________
Try to take over the world!
Message 2 of 5
(3,665 Views)

Thanks tst, so far today I've cracked on with option 2 after finding it hard to find any good 3D stuff in LabVIEW (outside of the robotics module...but i ain't got no coin for that). So far, so good, I can programitically rotate and move an object in Blender using Python. 

 

My socket programming experience is limited, I have only used TCP and UDP for basic file upload and transfer with Java. As such, I'm just wondering if there is any disadvantage to simply writing to a .txt file in LabVIEW say every say 10th of a second, and reading from it using Python at the start of every frame in Blender rather than using lower level sockets programming?

0 Kudos
Message 3 of 5
(3,658 Views)

My experience with Python is extremely limited and certainly doesn't extend to working with sockets, but I would expect them to be relatively easy in Python. I thought that connectivity is one of the major points of the language. Certainly the code on the LV side should be fairly simple, as you don't really have to do low level socket management.

 

As far as the text file goes, it should probably work. The only things I would be concerned about are speed (I assume that varies by OS, but flushing the buffers to disk might take some time and I don't know if you can consistently reach 10 Hz) and locks on the files (you need to make sure that opening the file on one end, even if it's read only, doesn't lock it on the other end). If the code is simpler, you could start with that, but I don't think I would use it as a long term plan.


___________________
Try to take over the world!
0 Kudos
Message 4 of 5
(3,649 Views)

Moreilly91,

 

Did you ever end up completing this project? Specifically, I'm interested in knowing if you had any luck controlling the Blender animation with LabVIEW.

0 Kudos
Message 5 of 5
(3,324 Views)