Jump to content
Keyglove Forums
WhizzWr

Autodesk Inventor COM API

Recommended Posts

I definitely do intend to release the source code, though it's not finalized yet (actually I haven't been back to it in a while). The original source for what I ended up with is available here:

 

http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/Imitating-Full-Navigation-Wheel-orbit-pan-zoom-through-COM-API/m-p/3593926#M39544

 

That forum member was immensely helpful. You're welcome to the code from there for now at least.

Share this post


Link to post
Share on other sites

Whoa, big thanks!

I'll see what can I do with it. Of course I'm going to open-source my code if I think my changes are good enough.

That's said I'm not a pro coder in any sense though, most likely it's going to take a while and I ended up with messy code. Haha

hint: it's for capstone project

Share this post


Link to post
Share on other sites

Jeff,

 

I just started looking into the code.

 

If you don't mind I have a few questions:

  • What exactly are gyroX, gyroY and gyroZ? are they simply the Euler angle of roll, yaw and pitch?
  • I'll just assume you used serial communication to send the IMU readings, but what serial listener are you using in Inventor Add-in and how do you store the buffers?

I'm aware there is IO.Ports.SerialPort in Vb, but I'm eager to know what implementation you do use..

 

 

Thanks!

Edit: Just found keyglove has its own Github repo (http://github.com/jrowberg/keyglove), the answer to question #1 must be somewhere on the repo.

Share this post


Link to post
Share on other sites

The repo doesn't have the Autodesk plugin code yet, but it does have the device side of the serial data. The gyroX/Y/Z values are scaled but otherwise raw measurements from the digital motion sensor. They are (ideally) zero when you aren't rotating your hand, and then go non-zero when you start rotating. Linear acceleration should have no effect--only rotation.

Share this post


Link to post
Share on other sites

Jeff, thanks for replying.  :)

 

 

 The gyroX/Y/Z values are scaled but otherwise raw measurements from the digital motion sensor. 

 

What kind of scaling I've got to do in order to make the measurement usable in the example inventor code?

(I'd more than happy to find it myself if you're willing to point me to which .ino file and which line  ;) )

 

 

Say.. using your sketch here http://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/Examples/MPU6050_DMP6/MPU6050_DMP6.ino

 

Which variables should I scale and use?

Quaternion q; // [w, x, y, z] quaternion containerVectorInt16 aa; // [x, y, z] accel sensor measurementsVectorInt16 aaReal; // [x, y, z] gravity-free accel sensor measurementsVectorInt16 aaWorld; // [x, y, z] world-frame accel sensor measurementsVectorFloat gravity; // [x, y, z] gravity vectorfloat euler[3]; // [psi, theta, phi] Euler angle containerfloat ypr[3]; // [yaw, pitch, roll] yaw/pitch/roll container and gravity vector

I think it's either VectorInt16 aaReal or VectorInt16 aaWorld.

 

Also what about the serial port implementation..? :D

 

Your help is much appreciated!

Share this post


Link to post
Share on other sites
What kind of scaling I've got to do in order to make the measurement usable in the example inventor code?

 

 

The data that I used comes only from the gyro, which has a range of +/- 250 degrees/second on a scale of [-32768, +32767]. So the scale factor to convert the raw values into actual floating point degrees per second is "value * 250 / 32768", assuming you have properly interpreted the 16-bit measurement data as a signed integer value so that it is reported as between -32768 to +32767, and not 0 to +65535. What you do with the scaled value, or how much you scale it, depends on how you want it to behave in Inventor.

 

Which variables should I scale and use?

 

 

The MPU6050_DMP6.ino sketch actually has a ton of code that you don't need, and very little that you do. The raw example is much closer without anything you don't need:

 

https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/Examples/MPU6050_raw/MPU6050_raw.ino

 

You can use that and just directly pass the gx/gy/gz data (raw gyro values) from the Arduino into your custom intermediate/driver/plugin application over the serial port. Any scaling necessary is done in the Visual Studio application.

 

...speaking of which: yes, I used the serial port, since that's the easiest way to get access to data from an Arduino. You need to have a serial port object in your Windows application design, reading the values from the Arduino and processing/scaling them as desired.

Share this post


Link to post
Share on other sites

Okay, more or less I can understand the the whole gyro scaling thing after I inspected the ChangeView() code from Autodesk forum. Thanks for the heads up.

 

Now I think what  I should do next is to make a "update" method that will invoke changeview() should the gyro value changed. (i.e from serial stream).

 

My algorithm is as follow:

 

  1. Start
  2. Get gyro reading
  3. Do rotation based on gyro value
  4. Do the gyro reading changed (significantly)?  if yes go to step 2 if no, proceed
  5. Stop

 

Am I going to the right direction? I could really use your expertise on this matter.   :)

 

 

Anyway, I'm sorry for being a little bit slow on the uptake, I'm kind of new on the embedded computing world.

 

From the video I see you have already made a working implementation, on both translating and rotating the object.

Initially, I was hoping to see and learn quite fast from your Inventor application source code, however I can understand if you do not wish to release your code, at least for now. 

 

So for now I'm making this from scratch. Thanks for your time, Jeff. I really appreciate your help.

Share this post


Link to post
Share on other sites

That algorithm appears to be roughly correct. It really depends on how exactly you want to have the motion affect the model in Inventor--whether and how to use motion scaling, smoothing, acceleration, etc.

 

I am not opposed to releasing the VB code that actually accomplishes the Inventor COM interfacing, but I'm not sure what state it's in at the moment since I've been focusing rather heavily elsewhere and have replaced my PC since that video was made. I need to reorient myself with the interface and clean things up a bit first, and of course make sure that it is working as intended. Once that's done, I will add that code to the repository.

Share this post


Link to post
Share on other sites

Yes, I will definitely consider motion scaling and smoothness factor when I actually finalised the algorithm. The algorithm I pointed is still pretty rough  :)

 

Ohh I see, Yeah, I get what you mean, it's going to take some attention and time to revisit such dusty project, not to mention you must have other stuff more important to do.  :wacko:

 

In that case, say, *if* you could be willing to share the COM interfacing code "as-is", I'll be grateful, there must be one or two thing I could learn from the codes. 

 

Of course if you decided to only release the working code to repository. I'm okay with that too. I'm going to watch your git repo for upcoming commit.

 

Thanks Jeff.  ^_^

Share this post


Link to post
Share on other sites

Jeff,

 

I have successfully implemented the rotation using Gyro on all the three axes. Instead of using a scaled raw gyro value, I decided to take advantage of  the DMP integrated on the MPU9050.

The changeview() method readily accept rotation angles in radian. So just fed the fused euler angle and developed the algoritm I mentioned above.  Turns out it works rather well. My implementation still definitely has lot of rough edges, tough.

 

Next milestone is the translation. I'm aware double integration of the acceleration reading could result in distance. I have played with 1 dimensional distance measurement. Horrible error accumulation, though.

 

However I can't quite grasp the following concepts :

1. The measurement of translation in 2 axes x-y (1 plane) using 3d accelerometer. Can we just  cancel out the acceleration toward irrelevant angles/direction?

2. The basic algorithm for making object translation on Inventor. I know there are MoveFeatures.CreateMoveDefinition Method and MoveDefinition Object on Inventor.

 

I appreciate that you've been really-really helpful since the beginning,

 

 Thanks in advance

 

EDIT: I just re watched the video and realised the object translation  is actually triggered by rotating gesture! Is that gyro reading in the works? (i.e. Roll for X movement and Pitch for Y movement)

 

Let see if I can work something out

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×