Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

Stingray + Arduino

alberto.arenas
Explorer

Stingray + Arduino

alberto.arenas
Explorer
Explorer

Hi everyone,

 

I'm working on a POC to test how Stingray would be able to be used to create interactive visual expiriences and in order to do so I'm using Arduino to gather the sensors inputs and drive the actuators but now I need to interface Arduino from Stingray to be able to make the visual output interactive with the Arduino sensors. I've done some exploration and I haven't be able to do it. I would need some help with the following questions:

 

1. Is there a way to access the serial port using Stingray Lua SDK?

2. If there is not, it seems there are a couple open source Lua libraries out there but all require compiling it manually. Would it be possible to get some help on how to add an external Lua module or library to the existing Stingray Luda SDK to be able to use it during the game execution?

3. If connecting with the serial port is complicated, does Stingray provides any solution like the Maya command port? Is there a way to open a socket in Stingray using the Lua SDK and keep it open during and listening so I can send the info from Arduino via TCP/IP or so?

 

Thanks,

Alberto

Reply
Reply
0 Likes
Reply
698 Views
3 Replies
Replies (3)

dan.matlack
Alumni
Alumni

@alberto.arenas I've reached out for some more info for you on how to do this. In the mean time, please check the help docs and maybe this thread could be of assistance.

______________________________________
Dan Matlack
Senior Content Manager || Games Solutions
Autodesk, Inc.
Reply
Reply

_robbs_
Alumni
Alumni

Hi,

 

first, to answer the questions in order,

 

  1. There's nothing built in to the Lua API for accessing the serial port.
  2. Yes, you can use external Lua modules. See below.
  3. No, there's nothing (yet) for exposing sockets, but again this is doable through an external module.

So, how to get an external module working in Stingray.

 

I'm assuming that the module you want to use is based on C code, and contains pre-written bindings for Lua. In this case, you'll need to:

 

  1. compile the module to a .dll. Instructions for doing this should come with the module. However, you'll have to compile it against the same version of Lua that we use in Stingray. For version 1.1 (the current version), this is LuaJIT version 2.0.0. Also make sure that you build for 64-bit platforms. This part can be a bit of a headache, but really depends on the module you want to use.
  2. put the .dll file next to your engine executable, so that the engine can find it.
  3. in your project's Lua code (say, in the project.lua file if you're using a template based on the Appkit), put in a require statement that will load the functions from your library into the Lua environment.
  4. call the functions in the module from your project's Lua code when you need them. For example, you'll probably want to add some code into the Project.update() function inside project.lua.

Which module were you thinking of using? If you run into trouble I can give it a try myself and see if I can help.

 

Reply
Reply

Anonymous
Not applicable

Waiting for developing some nodes in Unit Flow for Ardruino and Kinect .

Reply
Reply
0 Likes