|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#16
|
||||
|
||||
|
Re: Mechanum wheel programming in C++
Ok, I am really new to C++, we are using the SimpleRobot class. can help me out by telling me what kind of a loop I put around it (MecanumDefaultCode.cpp) and some details like that. Do I need a .h file to go with it? What else do I need to add to make it work with the default sample code? by the way, does anyone know of a tutorial that explains how to use most/all of the WPI Library commands? I don't know how to use hardly any of them. this is my first year coding and all of the programmers graduated last year so I'm looking for any possible help.
|
|
#17
|
|||
|
|||
|
Re: Mechanum wheel programming in C++
Most likely, you would want to put the mecanum code inside of the "while(IsOperatorControl())" loop of the OperatorControl function of the SimpleRobot class. Also, I believe the code would change slightly as the SimpleRobot template uses different variable names, and does not use pointers. (I don't have our classmate in front of me, so someone correct my code if I'm mistaken)
Code:
while(IsOperatorControl())
{
myRobot.MecanumDrive_Cartesian(stick.GetX(), stick.GetY(), stick.GetTwist());
...
http://firstforge.wpi.edu/sf/docman/...tation/doc1197 While I haven't looked through this very much yet, this should document most, if not all the WPILib classes with examples of using them. It is written for both Java and C++, so make sure you don't get the code mixed up. http://firstforge.wpi.edu/sf/docman/...tation/doc1196 |
|
#18
|
|||
|
|||
|
Re: Mechanum wheel programming in C++
Our team used mecanum wheels with the Logitech Extreme 3D Pro joystick last year for Breakaway and it worked very well. Programming was a little tricky but on the whole that was offset by how quickly we could change directions with only one joystick. I highly recommend the single joystick solution.
|
|
#19
|
|||
|
|||
|
Re: Mechanum wheel programming in C++
Quote:
|
|
#20
|
|||
|
|||
|
Re: Mechanum wheel programming in C++
So Joe I downloaded your code and am trying to get it to build in Windriver.
Sorry but myself and the kids are just getting familiar with Windriver. I opened it but it would build. Any suggestions? thanks John |
|
#21
|
||||
|
||||
|
Re: Mechanum wheel programming in C++
Quote:
Last edited by Ether : 18-01-2011 at 11:14. |
|
#22
|
||||
|
||||
|
Re: Mechanum wheel programming in C++
Would you be able to program/run it with only a two axis joystick? My team wants to run this years bot as a CO-OP and have two joysticks with one Logictech controller for the shooter/loader system.
|
|
#23
|
||||
|
||||
|
Re: Mechanum wheel programming in C++
Quote:
How are you planning to take advantage of the 3 degrees of freedom of a mec drivetrain using only one 2-axis joystick? Changing modes with a button perhaps?? WPILib has code for mecanum. |
|
#24
|
||||
|
||||
|
Re: Mechanum wheel programming in C++
What about field-centric? My team tried this out a few times but got really weird results. Would the following code snippet be correct?
Code:
[...] gyro->Reset(); float theta = gyro->GetAngle(); [...] yVal2=(float) (yVal*Math.cos(theta) - xVal*Math.sin(theta)); xVal2=(float) (yVal*Math.sin(theta) + xVal*Math.cos(theta)); |
|
#25
|
||||
|
||||
|
Re: Mechanum wheel programming in C++
WPILib now has mecanum code, with field-centric option. Take a look at that (use just use it as-is).
|
|
#26
|
|||
|
|||
|
Re: Mechanum wheel programming in C++
Our team uses SimpleRobot and here's our code for Mecanum/Omni drive using a 3 axis joystick (you may have to reverse some motors for it to work right and/or switch axis channels around)
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|