LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

3d Labview simulation

Hello World

 

I have attatched my work. Two files: Footballsimulation with ball.stl and a labview VI.

 

1) Basically - I am disappointed to find that the colors are not showing in the labview I have attatched. Why is this? Can somebody fix this form me. I tried adding all the lights I coul - but no luck.

 

2) When the above lights are sorted - I would like to move the spherical red object on the screen ( which will be tracking in real life a ball say) automaticall. Is this possible with Picture control or do I need something else? I will give more information if you would like me to further explain.

 

Cheers

 

Saqib

 

0 Kudos
Message 1 of 24
(5,275 Views)

Just to add for the query about the ball:

 

I can track in the real world a round object using cameras. It is this live x,y,z coordinates that will feed into the VI I attatched. Simply said than done though. Like for instance, in the stl file I attacted - I also inserted a red ball which I would like for it to move. However- I do not know how to select that specific object in the stl file for me to translate it.

 

Hope that make sense. Let me know if your unclear on anything.

 

Thanks

 

Saqib

 

0 Kudos
Message 2 of 24
(5,268 Views)

I would make a few recommendations, some of which may solve your problem, some probably don't but are good for performance.

 

 

1. Create your light one time, and just modify its parameters in the loop.  You probably already knew this.

2. I don't think .stl files include color information for their vertices so my guess is that the object will render black.  If they are black they won't show up regardless of the color of the light you are shining on them.  You should use the Material properties on SceneObject to give your object a "color".

3. I don't know if the camera is pointing at the object you are loading.

 

Attached is a VI with some updates to give you an idea of what I mean.

 

Jeff Peters

LabVIEW R&D

 

0 Kudos
Message 3 of 24
(5,259 Views)

Thanks for your quick reply. Yes I have had a look at your solution and I can see how it works.

 

I am just gutted though because I spent a while making that stl file and to find that it doesn't load it up with the color is a little annoying. I ould add color onto it but I dont know how to select specific objects from the model I have you see. As a result I think I am going to make the same model in a different package and export it as a VRML. Would I be guaranteed color this time?

 

There must be a reason though why labview allows stl or VRML. Why is this? WHy is one better than the other?

 

Side questions regarding the stl or vrml file model

 

1) I will have inserted a ball in the model. I can select that independently and translate it to my need right? I remember reading it was possible for a VRML file. How do I do this in for the stl model? Because I dont know how to select an object from the stl file i imported.

 

2) Can I ask that if you zoom in or out using the mouse when running the front panel - the scale of the actual translation should not change right?

 

3) From the original vi file I attached - how do I add coordinate information about the present model imported? 

 

Basically - I want to work from my 3d model and use the red object ball to translate around - keeping the other objects stationary.

 

Thanks

 

Saqib

0 Kudos
Message 4 of 24
(5,228 Views)

We allow for multiple formats mainly for convenience for our users.  Both of these formats are supported by popular CAD tools.

 

I am not expert on either of these formats, but in general an STL file is a specification of a triangulated surface without color where VRML supports many different types of primitives, colors textures etc. 

 

I don't think that STL files support having multiple objects in the "scene".  When we parse an STL file you will get a hierarchy of exacly one item.  If you expect to load a the model of the football field and a model of a ball, I don't think that STL is the right choice.

 

In short, STL supports describing a singular 3d model, where VRML supports describing a 3d scene with a number of different models in it.

 

There are probably better, more detailed explainations and comparisons out there and I encourage you to google the formats to find them.

 

Every SceneObject has its own transform.  You can independently translate, rotate, scale any object in the scene that you desire.  This really isn't about file formats other than it seems like you expect to be able to have a model, say, of a field, with a ball inserted into it. 

 

Given that information, I think that VRML seems better suited for your application.  You could load a scene, field and ball, complete with color information, etc, then use the "FindObject" method on SceneObject to find the ball so you can manipluate its transform

 

On the other hand, it may be easier to just have a model of the football field and then insert an object that you build with a sphere in LabVIEW code into the scene.

 

When you zoom in on the 3d picture control you are affecting a different transform than your other transforms on your objects, so they are independent in a sense.  If you, say, zoom in, any translations you have done to objects will be naturally affected because the scene is now closer or further to you -- they may look bigger or smaller in pixels. 

 

I don't understand the last question, maybe an example would help.

 

Jeff Peters

LabVIEW R&D

 

 

 

 

 

0 Kudos
Message 5 of 24
(5,213 Views)

Hey Peter its alllllll ok now haha Smiley Very Happy

 

All I needed to do was to look on google for a converter which converted my file into the vrml! And hey - The picture comes in full monty color!

 

Now the problem for me is that I would like to know how to select the objects. Attatched is my VI which is basically a copy of the tutorial on the ni website. Problem is - I can not select the ball alone. Because I only want to move the ball now. i.e. the vrml has a goal area of the foootball pitch which is one object and another object - a red ball. So I want to only select the red ball from this vrml and translate it. I know how to translate it but I get an error when I try to select the red ball. HOw do I select it?

 

Thanks in advance

 

Saqib 

0 Kudos
Message 6 of 24
(5,211 Views)

Sorry Peter - I was writing my message in before I read your post and you have suggested use the "find object". I will try that rtight away and see if I can search the object. How would I know what the name of the object is. I dont recall labelling my objects when I was doing the model in the CAD drawing.

 

I will try manipulating the red ball in the above object. If things dont work Out I will use the "create sphere" instead. Thing is though, if I do create a sphere and I manage to translate it - how can I make it move say 1cm with respect to the field. How can I obtain this scale information from labview?

 

Cheers Peter for your support so far

 

Saqib 

0 Kudos
Message 7 of 24
(5,209 Views)

Actually Peter I just found something out. The VRML file I have has apparently detected only one object.

 

See attatched VI and use the loader to look for the vrml attatched too. You will find it only finds 1 objkect. So strange because in my CAD package (using VERICAD) I made sure I had grouped everything except the ball into an object. I am still confident there aare two objects but labview only dects 1. Even if there are 2 objects - I still do not know how to select the ball because I dont know what it is called in the vrml. I even tried opening this vrml with the notepad but i failed to find the name from their.

 

Maybe the create ball sphere is the other option. I will try this first thing in the afternoon.

 

Saqib. 

0 Kudos
Message 8 of 24
(5,201 Views)

Looking at your VRML file I think that you will only get one object with a bunch of children.  That is, there is one root object and the ball, goal posts, field are children of this root.

 

For example you will see in your .wrl statements like this 

 

DEF __25 Shape

{

...

 

This means that you have a shape named "__25" in your scene.  You can use Find Object to find it.

 

I don't know which is the ball either, but I suspect we can figure it out by taking a close look at the vertices or by just coloring each object in the vrml file a different color.

 

I do think that instead of putting the ball in the scene it makes sense to keep it separate, that way you could load any field and place the ball in it. It might well be easier than trying to find it in a more complicated scene too.

 

Jeff Peters

0 Kudos
Message 9 of 24
(5,196 Views)

Hello Peter

 

Well I have taken your advise on creating a sphere and manipulate that. I have suceeded ! So Thank you for that,

 

However... As usual there are always going to be problems and I have attatched my up to date vi of the football simulation.

 

Basically my problem is as follows:

 

1) Why is it that when I change color it des not change at all?

2) Why is it that when I change my scale value  the sphere will automatically scale accordingly however why is it that the translation does not scale.

For instance- when I change my scale from 1 to 0.1, I see my shpere scales down. But When I translate it in say the x,y,z axis, it is moving exactly

the same distance as if when the scale was 1. Try it and see for your self - I think it is my ordering of the blocks but I thought it made sense the way I connected them. This is a huge problem if not resolved for me becaue in the real world I will make a certain distance measurement, and thereby from it I will work out a scale ratio - so that when the object of my interest moves - the simulation will move the ball by the correct distance with respect to he dimensions in the sceneary. 

3) Why is it that when I change the scale - the ball changes size - which is not what I expect because the scaling is done after the ball geometry is drawn.

 

 

Thank you for your support so far. You have encouraged me to draw a ball all this time and it actually makes sense to so thanks for that. Can you please guide me in the above problems please { open to anybody else too that got the knowledge:) } You can use the wrl file I sent previously.

 

Oh and in the meantime I will move on continue this vi to make the ball output an LED when say the ball reaches a certain range. I have seen a vi for this and will ammend it for my needs for now.

 

And before I go - please excuse my spelling mistakes Smiley Tongue- I am writing as I am thinking.

 

Thank you

 

Saqib 

0 Kudos
Message 10 of 24
(5,173 Views)