LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Making sub-programs with picture objects

Hello all,

 

I'm a mentor for a FRC Robotics Team. For the summer, I want to try to make a VI that is able to create sub-programs for the autonomous period. Basically, there would be this canvas that the user could move the "robot" (aka rectangle) around, and it would record its movements and "translate" them into "motor code".

 

For instance: I want my robot to go straight for about 3 feet, rotate 90 degrees clockwise, and go another 3 feet. I would take the rectangle, drag it up an equivalent 3 feet (maybe using a grid pattern to show 0.5 feet increments), rotate the rectangle 90 degrees clockwise, then drag it another 3 feet.

 

This is the big picture. Right now, I want to know if it's possible to have a user drag a picture (such as a rectangle) and have the program where it is on a coordinate plane.

Thanks!

0 Kudos
Message 1 of 4
(2,820 Views)

I'm tempted to say "Yes" based on the following:

  • The Event Structure allows (on a Pane Object) Mouse Down, Mouse Up, Mouse Move, etc. Events
  • The Mouse Events give you Mouse coordinates.
  • From the Mouse coordinates, you can move the underlying Object to a new location.

I believe there may even be a LabVIEW Example somewhere showing this.

 

Turning may be the hard part.  However, if you are at Location 1 and move the mouse to Location 2, you could, in principle, use the angle going from 1 to 2 to set the rotation of the Object.  Thus if you moved the mouse up and down, the (call it a) Car would go up and down.  But if you moved the mouse to the right, the car would swivel to the right and then move.

 

Good luck with this project.

 

Bob Schor

0 Kudos
Message 2 of 4
(2,807 Views)

I've been finding similar results.  Using the mouse coordinates instead of an object's.

 

Also, to specify, these robots COULD be (not always) holonomic drive, which, if you don't already know, means they can strafe.  So, if it came to that, I would need a rotation factor somehow.

 

Thanks for the quick response!

0 Kudos
Message 3 of 4
(2,796 Views)
Whenever I hear someone ask, "Can LabVIEW..." I always say yes, regardless of what comes next. In the the case of your requirement, there is (or at least was) an example in one of the lower-level training classes that did most is what you want.

The point of the exercise was to teach saving binary data, but to generate the data (this is the bit that will be interesting to you) they created a little drawing program using mouse events on a 2D picture control.

So, yes, what you want to do is very doable, my sense though is that it is one of those projects that would take a couple hours to create a working prototype, but you could play with tweaking for months...

Have fun!

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 4
(2,792 Views)