|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Simulate robot drive
If you devote your time to it, that's definitely doable in one summer.
When I was making a simple robot movement simulator, I often used the "Re/Im to Polar" and "Polar to Re/Im", for converting between Cartesian and polar coordinates. (They're found in the "complex" subpallette of Numeric) If you're not already familiar with Sine, Cosine, and Tangent, you should become so. As for actually creating the code, make sure to start with your definition. What do you want to accomplish? What are your inputs (controls)? What are your outputs (indicators)? You can create the front panel of your main VI first, and that will help define your code later. (For example, you can have a VI that has the inputs of speed, direction, acceleration, rate of turn, and elapsed time, and the output of change in position. You know that every one of those inputs makes a difference in the value of the output. Now you just need to figure out WHAT the relationship is, and how you would describe that in a formula.)] I have a brief overview of the process of software development here: http://kamocat.com/programming/development.php It's simple enough to not get lost in, but if you have any questions or need further detail, please ask. |
|
#2
|
|||
|
|||
|
Re: Simulate robot drive
How do you make your code work? both the default and final picture are blank.
|
|
#3
|
||||
|
||||
|
Re: Simulate robot drive
I made this when I was first learning LabVIEW, so I apologize that it's not very intuitive.
First set your initial position. (300,300) is a good place to start. Start the VI with "continuous run". Now click "initialize". This will clear the image, and reset the robot position. Click it again to commence the movement. To move, use the "speeds" sliders. It appears that the left and right are mixed up, so you may want to fix this. One thing to note: At this point in time, I would not consider this an example of impeccable code. It works, and it's readable, but it's not intuitive, and the way it plots points on the picture is inefficient. If it would help to have a better example, I will fix this up for you. |
|
#4
|
|||
|
|||
|
Re: Simulate robot drive
If you could fix up the code I think that would help tremendously. Also would you mind describing what is happening in the relative movement vi? I really appreciate this, I feel like I'm really good at programming hardware in intuitive ways but terrible at creating virtual simulations of what it should do.
But yes I understand sin, cosine, and tangent. But not well enough to fully figure out the swerve drive quite yet (That can wait for awhile since we don't even have a swerve drive built yet). |
|
#5
|
||||
|
||||
|
Re: Simulate robot drive
Okay, here's an improved version.
I made an some options for it to be controlled via Joysticks, but I haven't implemented that yet. (The appropriate VIs are in the HID pallette. Make sure you're targeted to your computer; Human Interface Device drivers aren't available for the cRIO, and so that palette will be hidden.) EDIT: It's still not impeccably documented, but it should be clear what each section does, if not why it works. Last edited by kamocat : 01-04-2011 at 02:34. |
|
#6
|
|||
|
|||
|
Re: Simulate robot drive
Well I now feel stupid w/e seems like a very useful tool. Thanks for all of the hard work that was put into this hopefully I'll get to using it.
|
|
#7
|
||||
|
||||
|
Re: Simulate robot drive
I'm not sure how much it will help with autonomous; anything it can show can be calculated using a drawing.
However, it might be useful as a little code debugger. Run "autonomous independent" while targeted to your computer, and it runs through this? That might be fun. Remember: a simulation is only as realistic as you make it. Don't forget to "check your work" and make sure it describes what is actually happening with the robot on the field. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|