Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Reading serial port in real time?

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
Anonymous
2514 Views, 6 Replies

Reading serial port in real time?

Hey Y'all

 

I've got a question regarding using the C++ API to read from the serial port from an Arduino in a continuous fashion. I'm essentially trying to recreate this:

 

http://www.geekmomprojects.com/mpu-6050-dmp-data-from-i2cdevlib/

 

And I feel like I'm pretty close. I can post some code if you'd like, but as of now I have a command plugin that reads in a quaternion from my gyroscope circuit over USB and prints it in the output window (it prints the four components of my quaternion). This happens continously, but I'm not sure how to use a command plugin to rotate an object in real time using this stream of data. I can set the rotation quaternion, but it appears as though nothing changes in the viewport until the plugin doIt method returns.

 

What it comes down to is my need for some sort of continuous loop that will run for as long as I tell it to. At each loop iteration it's got to read from a quaternion from the serial port and set my selected objects transform accordingly. Is this possible?

 

Also as a follow up, is it possible to use MEL commands from the C++ API? I'd like to keyframe things like I've done in Python using maya.cmds, but I don't know what the equivalent would be in C++.

 

Thanks for reading,

 

John

6 REPLIES 6
Message 2 of 7
cyrille.fauvel
in reply to: Anonymous

Hi

 

I believe you need to understand the Maya MotionCapture API. the best way to start with this would be to read the following articles and see the companion samples. If you still have issues, please let me know and I'll be happy to help,

 

Maya Device API - http://around-the-corner.typepad.com/adn/2012/12/maya-device-api.html

Initial fooling around with Kinect and Maya - http://around-the-corner.typepad.com/adn/2013/02/initial-fooling-around-with-kinect-and-maya.html

Using the Microsoft Kinect SDK to bring a basic point cloud into Maya - http://around-the-corner.typepad.com/adn/2013/02/using-the-microsoft-kinect-sdk-to-bring-a-basic-poi...

 

Hope that will help,

Message 3 of 7
Anonymous
in reply to: Anonymous

Thanks! This seems like a great place to start.

- John
Message 4 of 7
zittkowski_andreas_h
in reply to: Anonymous

Saw your post about reading serial ports in real time, and I'm trying to do something similar. I know you posted this like seven years ago, but I was wondering if you could send me the code that you had worked out to that point so i could study it? I'm pretty new at writing plug-ins, and I'm encountering the usual walls and drops on a subject that nobody else seens to know anything about.

 

 

renderbomb@yahoo.com

 

Thanks.

Message 5 of 7

Hey, You'll find all the articles and source code following this link

https://around-the-corner.typepad.com/adn/kinect/

 

Happy reading 🙂

cyrille

Message 6 of 7
zittkowski_andreas_h
in reply to: Anonymous

Great articles, thanks very much for providing the link.
 
You said that realtime wasn't really possible because Maya was only single-threaded, but that was 2013.
Now with Autodesk's emphasis on multiple threads and even support for GPU computing for some tasks,
do you think that's a different story now? How does this affect code writing for the Maya API?
 
Thanks again.
 
Message 7 of 7

By definition running on a preemptive OS, you cannot be realtime - you are close though.
Maya engineering made a lot improvement on making its DG engine multi-threaded which certainly helps to be closer, but many things still runs on the main thread (single threaded), so my comment is still valid. Close but not yet there.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report