Go to Post Inspire others first, win second. - Alpha Beta [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 29-05-2011, 01:39
Thad House Thad House is offline
Volunteer, WPILib Contributor
no team (Waiting for 2021)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Thousand Oaks, California
Posts: 1,107
Thad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond repute
separate classes

Our labview programmer uses seperate VI's for everything and i was trying to do the same thing in java. for some reason i cannot get it to work. it compiles correctly and uploads, but it never then works. can i get any help.

here is the code

thanks
Attached Files
File Type: zip spike.zip (2.5 KB, 19 views)
__________________
All statements made are my own and not the feelings of any of my affiliated teams.
Teams 1510 and 2898 - Student 2010-2012
Team 4488 - Mentor 2013-2016
Co-developer of RobotDotNet, a .NET port of the WPILib.
Reply With Quote
  #2   Spotlight this post!  
Unread 29-05-2011, 02:19
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: separate classes

The only thing I see without knowing what you symptons are, is that you never instantiate DriveRobot.driver.

In the future when you post issues like this, you need to include more information. Are there any errors? Does the DS say "No Code", "Watchdog Not Fed", etc? Does the DS message change when you enable or disable it? These are all important pieces of information we can use to help find your issue.

I would also say that seperating functionallity is often a good thing, but you're sperating things in an unusual way. I suggest you spend some time reading Java code posted by other teams. It may give a better idea of how Java programs should be partitioned.
__________________
Eric Haskins KC9JVH
Reply With Quote
  #3   Spotlight this post!  
Unread 29-05-2011, 09:00
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,125
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: separate classes

Quote:
Originally Posted by sst.thad View Post
for some reason i cannot get it to work. it compiles correctly and uploads, but it never then works. can i get any help.
You might get more help if you explain what you mean by "it never works". Does that mean it does something.. but not what you expect, or does it mean it's completely DOA. Also, give some detail about what are all the indicator LEDs doing.


Reply With Quote
  #4   Spotlight this post!  
Unread 29-05-2011, 13:12
Thad House Thad House is offline
Volunteer, WPILib Contributor
no team (Waiting for 2021)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Thousand Oaks, California
Posts: 1,107
Thad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond repute
Re: separate classes

When i run the code on the robot, it runs and enables, but the joysticks never control anything. the victors do enable. i put relay code into the main file in the operatercontrol section, and it does not run either. so i do not belive the code gets to operater control.
__________________
All statements made are my own and not the feelings of any of my affiliated teams.
Teams 1510 and 2898 - Student 2010-2012
Team 4488 - Mentor 2013-2016
Co-developer of RobotDotNet, a .NET port of the WPILib.
Reply With Quote
  #5   Spotlight this post!  
Unread 29-05-2011, 13:20
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,125
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: separate classes

Quote:
Originally Posted by sst.thad View Post
When i run the code on the robot, it runs and enables, but the joysticks never control anything. the victors do enable. i put relay code into the main file in the operatercontrol section, and it does not run either. so i do not belive the code gets to operater control.
When you say "the joysticks never control anything" what do you mean by that? Do you mean you've checked the status lights on the motor controllers and they are not responding to the joysticks? Do you also mean that you've checked the PWM indicators in the Dashboard and they are not responding?


Reply With Quote
  #6   Spotlight this post!  
Unread 29-05-2011, 17:22
wmarshall wmarshall is offline
Registered User
FRC #0011
 
Join Date: Jan 2011
Location: New Jersey
Posts: 8
wmarshall will become famous soon enough
Re: separate classes

First, check the manifest file in the resources/META-INF/ folder. It should look something like this (note that MIDlet-Name can be basically whatever you want):
Code:
MIDlet-Name: ASimpleJavaBot
MIDlet-Version: 1.0.0
MIDlet-Vendor: FIRST
MIDlet-1: spike, , com.hedgehog.spike.spike
MicroEdition-Profile: IMP-1.0
MicroEdition-Configuration: CLDC-1.1
If that looks ok, then you should note that you code will throw a NullPointerException on robotInit(). You never instantiate RobotDrive.driver, as Eric mentioned, so any method call involving it will nuke the JVM from orbit. You probably don't need to call your drive methods twice (in RobotDrive.run() and spike.operatorControl()). In addition, I'm a bit confused by how you're attempting to drive your robot; you seem to be using three joysticks, using driver and secondary in RobotDrive.run(), driver and driver2 in spike.operatorControl(). Lastly, you may actually want to start the RobotDrive thread.

Java is a very object-oriented language, so you may want to investigate using static fields so that you don't have to instantiate your Inputs and Joysticks classes. Over here you can see our code. We made big steps in properly using Object Orientation to make our code not be a complete mess, and kinda succeeded.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 00:40.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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