![]() |
Simple Tankdrive with 4 CIMs
Hello all,
I'm part of a newbie team this year and after some research and long hours of watching videos I have a basic idea of the concepts of java programming, but I'm not quite sure how to actually write code that will be able to drive the robot. My first task is to find out how to write the code using tank drive with 4 CIM motors. Our team is planning on using the two included joysticks for left and right motor control. It seems like setting up the tank drive system is relatively easy (to experienced programmers) but I don't even know where to start. Can any of you offer any guidance as to how write the code for a tank drive system? I have downloaded Netbeans and the FRC plugins so I think I am ready to start writing code. Any help would be greatly appreciated, thanks! |
Re: Simple Tankdrive with 4 CIMs
This might help. You probably need to start from 'Creating a new Project...' on page 9 since you're already installed everything.
|
Re: Simple Tankdrive with 4 CIMs
I would suggest loading one of the FRC sample projects this will show you plus give you a good point to start changing code. This is done by going to File -> New Project -> Samples -> FRC Java -> then choose a project.
Also check out the below links. Java CookBook WPI Robotics Library Users Guide Java Getting started Brad Miller Videos Java doc If you need some detail help you can always PM me. |
Re: Simple Tankdrive with 4 CIMs
Ok so I have read over all those documents and followed the getting started with Java guide to put together some code using simple robot template.
here is my code: Quote:
Some questions: 1) is this code even going to do anything? 2) when you create the joystick objects and put (1) and (2) for ports, how does the computer know that joysticks are connected? Same for the motors, is just putting 1,2,3,4 for the 4 motors going to work? (I guess I just don't fully understand what ports we are connecting the motors and the joysticks to) 3) I think our team is planning on using the command based template when we code for the full robot, how do I implement this type of thing using the subsystem, command base, OI, and all of the different java files that go along with it? (It seems like the different parts need to be split up in order to work properly) |
Re: Simple Tankdrive with 4 CIMs
1) is this code even going to do anything? I am going to say yes. seem like no errors.
2) when you create the joystick objects and put (1) and (2) for ports, how does the computer know that joysticks are connected? You can see the Joystick and what port they are connected to by looking at the driverstation. Same for the motors, is just putting 1,2,3,4 for the 4 motors going to work?Yes, this will work. These will be the PWM of the digtal side card. I would suggest doing this tho Jaguar LeftFront = new Jaguar(1); ... 3) I think our team is planning on using the command based template when we code for the full robot, how do I implement this type of thing using the subsystem, command base, OI, and all of the different java files that go along with it? I would watch the videos i linked. |
Re: Simple Tankdrive with 4 CIMs
Quote:
|
Re: Simple Tankdrive with 4 CIMs
Everything looks right assuming you have 4 motors plugged to PWM 1,2,3,4 respectively to what RobotDrive method wants.
And like they said, you can always check and drag joysticks in the Driver Station. |
Re: Simple Tankdrive with 4 CIMs
Quote:
|
Re: Simple Tankdrive with 4 CIMs
Quote:
|
Re: Simple Tankdrive with 4 CIMs
Quote:
|
Re: Simple Tankdrive with 4 CIMs
Quote:
|
Re: Simple Tankdrive with 4 CIMs
Code for my test DriveTrain (although it has an arcade drive method as well.)
Code:
package edu.wpi.first.wpilibj.test; |
Re: Simple Tankdrive with 4 CIMs
Ok so now that I think that the code I wrote will work, I want to put it in the command based template. I watched the videos that Brad Miller posted and I know how the template works but am not sure how to set it up to make the tank drive work.
|
Re: Simple Tankdrive with 4 CIMs
Quote:
Interestingly enough, it's actually the same code from the video. :cool: Just make sure you comment out this line in CommandBase.java: Code:
Subsystem.registerDefaultCommands();- offtopic edit - I see you're from Cinci. Looking forward to competing with you guys at Queen City this year. ;) |
Quote:
And I did look at the gearsbot code and I wasn't sure if we need to set it up the same way because we aren't coding it to go a certain distance. Would I still set up the drivetrain as a PID subsystem? I think I all I need to do is add a subsystem, command, and modify both the OI and the RobotMap and I should be good. I'll try it out later and see what I come up with. |
Re: Simple Tankdrive with 4 CIMs
Quote:
|
Re: Simple Tankdrive with 4 CIMs
Quote:
|
| All times are GMT -5. The time now is 13:02. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi