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
Solved! Go to Solution.
Solved by cyrille.fauvel. Go to Solution.
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,
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.
Thanks.
Hey, You'll find all the articles and source code following this link
https://around-the-corner.typepad.com/adn/kinect/
Happy reading 🙂
cyrille
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.