Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Need serious help with coding!! (http://www.chiefdelphi.com/forums/showthread.php?t=104387)

Team1605 09-03-2012 10:38

Need serious help with coding!!
 
How can i program the part of my robot that will tilt the bridge towards me. i want it to go tilt forward then back. i am coding in netbeans (java).

Ginto8 11-03-2012 14:12

Re: Need serious help with coding!!
 
The answer to your question can be affected by a lot of things:
  • Which of the many different possible bridge tipping mechanisms are you using?
  • Is it controlled by a Spike, or a speed controller? If the latter, Victor or Jaguar?
  • Are you using the IterativeRobot template, or a Command-based one?
  • Do you want it to respond to user input? If so, should it be button-controlled or joystick controlled? Do you want a button to toggle it?
  • Are there any limit switches involved?
I don't want to give you bad advice, so a little more clarity would be helpful.

Jmgiacone 12-03-2012 17:56

Re: Need serious help with coding!!
 
A great tool that really helped me a lot was the getting started guide(here), and the FRC Programming Cookbook(here). These are both chocked full of great resources, examples, and explanations and are a great way to overcome problems.

abrightwell 12-03-2012 21:39

Re: Need serious help with coding!!
 
Quote:

Originally Posted by Ginto8 (Post 1142162)
I don't want to give you bad advice, so a little more clarity would be helpful.

+1

Also, do you have code that already exists that you would like for us to take a look over/review for you?

Team1605 19-03-2012 10:29

Re: Need serious help with coding!!
 
i am using jaguars(speedcontrollers) i have something like ahand with wheels that i want to tilt. i want a button to toggle it one button tilts forward other button makes it goes backwards

and yes i have code i will post it that too

Ether 19-03-2012 10:38

Re: Need serious help with coding!!
 
Quote:

Originally Posted by Team1605 (Post 1146060)
i am using jaguars(speedcontrollers) i have something like ahand with wheels that i want to tilt. i want a button to toggle it one button tilts forward other button makes it goes backwards

and yes i have code i will post it that too

How is the mechanism supposed to know when to stop, in each direction, after you press each toggle button? i.e. are you using limit switches, or a potentiometer, or an encoder, or something else?



kinganu123 19-03-2012 15:31

Re: Need serious help with coding!!
 
a basic code would be
Code:

if(joystick.getRawButton(4)
    jaguar.set(1);
else if(joystick.getRawButton(5)
    jaguar.set(-1);
else
    jaguar.set(0);


Sconrad 19-03-2012 15:41

Re: Need serious help with coding!!
 
Quote:

Originally Posted by kinganu123 (Post 1146195)
a basic code would be
Code:

if(joystick.getRawButton(4)
    jaguar.set(1);
else if(joystick.getRawButton(5)
    jaguar.set(-1);
else
    jaguar.set(0);


Note: This will not create a toggle effect. If 4 is pressed, the motor will go forward and if 5 is pressed the motor will go in reverse, but it will not continue to go in that direction if you let go of the button. However, this is a good, simple solution to the problem you are facing. One thing to note about how this code will perform, if both buttons are pressed, the jaguar will go forward. One way to fix this is to replace the first line with
Code:

if(joystick.getRawButton(4) && !joystick.getRawButton(5))
It is a little bit longer, but will protect you from accidentally going in the wrong direction should you hit both buttons in the heat of competition. In order to have a true toggle effect, you will probably need a limit switch or potentiometer or other sensor to tell you when you are done going up or done going down. Hope this helps!

Ether 19-03-2012 16:16

Re: Need serious help with coding!!
 
Quote:

Originally Posted by Ether (Post 1146061)
How is the mechanism supposed to know when to stop, in each direction, after you press each toggle button? i.e. are you using limit switches, or a potentiometer, or an encoder, or something else?

In addition to the above, the other issue you will have to deal with is: How are you going to hold the "tilted hand with wheels" in place once it has reached the desired position?




All times are GMT -5. The time now is 10:06.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi