![]() |
Re: Getting Familiar with Programming in WindRiver
Thanks both for the replies.
So in order to pull information from the HID joysticks, it has to be pure P&P that doesn't require any drivers whatsoever? So, if we find such as device, everything else should be preconfigured? For example, for a steering wheel, the wheel provides x-values, and the pedals provide the y-values? Or is there anyway to preset specific functions to specific buttons or features of the joystick? |
Re: Getting Familiar with Programming in WindRiver
most of joysticks come with drivers when you buy, but that doesn't mean you necessarily need that driver.
if you plug the joystick into the driver station, it'll most likely recognize the device without driver(unless the joystick really need driver). you'll need WPILib to get information of joystick status, which can be interpreted as it is preconfigured. you can assign specific functions to corresponding buttons by making if or switch case statements. for example Code:
the other way is having a lot(depends on how many buttons you'll be assigning specific functions to) of if and else if statements there might be other ways but I can't think of it at the moment |
Re: Getting Familiar with Programming in WindRiver
I see... Since there are 12 programmable buttons, I'm guessing that either the standard joystick is labeled or there's a diagram showing what button corresponds to what... But what if we use a different joystick? Do we have to test which buttons match which input source?
|
Re: Getting Familiar with Programming in WindRiver
most of the joysticks have number on each button, maybe except for trigger button and, if you're using logitech joystick and cannot figure out which button is which, install logitech gaming software that came with the joystick(to computer), execute it with joystick plugged in to one of the computer's usb ports, and start pressing buttons. the program will tell you what button you're pressing.
i don't know if other companies support those kind of software or not, but if you have logitech joystick, you can figure out that way if you're making your own usb joystick, then you'll have to label it as you make it, but if you're buying joystick, then i wouldn't worry too much about not knowing which button is which btw, if you want to test without robot or drivestation, run joystick-playable game and go to key configuration(or something like that), and try changing joystick key. it'll show you which button you pushed after you assign a key (for most games) |
Re: Getting Familiar with Programming in WindRiver
Thanks for the reply. You've been really helpful ever since I posted this thread.
After much thinking (upon watching the game), I think we've made the decision to go with the USB joysticks that we're given standard to our team (Logitech ATK3). Right now though... I have another problem that has been giving me major problems. Aside from not being able to get our camera correctly connected and configured when it's plugged into the cRIO... I'm not quite sure how I'm supposed to program it to track colors or shapes in WindRiver. Do I do so with pure code or is there another utility that helps monitor that? And of course... How am I supposed to implement that into the code. Secondly... Right now, the only way I've gotten the motors to move is through the RobotBase class. Is there any other way to control a specific motor (whether it be Jaguars or Victors) a specific speed? The functions in WPIlib.h only tells you what speed you want to set it to... but there are no parameters that reference the PWM port the motor is plugged into... |
Re: Getting Familiar with Programming in WindRiver
The PWM port is specified as a parameter to the constructor.
I think I read where the WPI guys are putting out an update to the camera classes (in the next few days) that works. How to use the data from the camera to guide your robot or dummper (or whatever) is up to you. |
Re: Getting Familiar with Programming in WindRiver
Mmkay... I think I kinda get what you're saying... But just to clarify... How would you get a motor on PWM1 to go half speed for 2 seconds and PWM2 to go full speed for 3 seconds?
As for the camera classes... Do we check back on the FIRST website or the WPI site? |
Re: Getting Familiar with Programming in WindRiver
Btw, in c++, you use -> to access elements of a class by pointer, and . to reference elements by refrence. I remember that concept always confusing me when I started out with OOP...luckily Visual Studio's Intellisense complains at you when you use the wrong one, so I learned quick enough :).
|
Re: Getting Familiar with Programming in WindRiver
Thanks for clarifying that up for me.
|
How do you open a new C++ file with WindRiver?
How do you open a new C++ file with WindRiver? I've already downloaded the FIRST version and it is working but I do not know how to actually make a new program. Thanks for the help.
|
Re: How do you open a new C++ file with WindRiver?
Quote:
Or did you mean to ask how to create a new project? |
Re: Getting Familiar with Programming in WindRiver
I have already set up WindRiver and the "MyRobot" template is set up but I don't know how to set up new source code files for my own robot code. I can't find it in the directions and I don't know what to do. Thanks
|
Re: Getting Familiar with Programming in WindRiver
Err... To do this go to File -> New...
And then select the project that you want. From there on the bottom there's a textbox where you type your file name WITH the extension. For example... If you want a C++ source file named test... then type in test.cpp. If you want a header file... for example, testlib... then type in testlib.h. It should automatically create a file in the project that you selected. |
Oh ok thanks
|
Re: Getting Familiar with Programming in WindRiver
Quote:
Select New->File from Template. The New File dialog will appear. Type in the new file's name. Click the Change... button. A Preferences dialog will appear -- here you'll select 'cpp_template'. Click OK in the Preferences dialog. Click Finish in the New File dialog. |
| All times are GMT -5. The time now is 12:25. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi