Go to Post Hearing about the beginnings of 842 was truly inspirational and has really stuck with me through the years. After following you guys for so long it was crazy for me to play with you. Thank you for all that you have done for FIRST in Arizona. - Saberbot [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 19-01-2012, 20:42
sand500 sand500 is offline
Registered User
FRC #3540 (Wildcat Robotics)
 
Join Date: Jan 2011
Rookie Year: 2011
Location: United States
Posts: 81
sand500 is an unknown quantity at this point
We got Sockets working

http://www.youtube.com/watch?v=N0xvqxRKCKg

What we have is the computer with the driver station has the PS3 controller connected to it. We then get input from the left stick of the joystick to the CRIO with the regular Joystick Class. Now to send that to the 2nd computer, we use java sockets with the CRIO running the socket server code and the computer running the client socket code. So far, we are just experimenting with sockets with last years robot.
Reply With Quote
  #2   Spotlight this post!  
Unread 19-01-2012, 20:51
Patrickwhite's Avatar
Patrickwhite Patrickwhite is offline
May the North be with you
FRC #0610 (The Coyotes)
Team Role: Programmer
 
Join Date: Dec 2008
Rookie Year: 2008
Location: Toronto
Posts: 88
Patrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of light
Re: We got Sockets working

Neat!

Your custom dashboard looks a lot like the Smart Dashboard - for what reasons did you decide to make your own, instead of using the Smart Dashboard?
__________________
while(!going.isTough());
tough.exit();

What will we do tonight, Warfa?
The same thing we do every night, Patrick. Sit and wait for Electrical.
Reply With Quote
  #3   Spotlight this post!  
Unread 19-01-2012, 21:10
neal's Avatar
neal neal is offline
Neal
FRC #1777 (Viking Robotics)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2009
Location: United States
Posts: 56
neal is an unknown quantity at this point
Re: We got Sockets working

Is that possible to do with SmartDashboard? I'd really love to get those bars for joysticks and the Gyro thing as well!
Reply With Quote
  #4   Spotlight this post!  
Unread 19-01-2012, 21:17
theNerd's Avatar
theNerd theNerd is offline
Registered User
FRC #3329 (Cam Bots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2110
Location: St. Marys
Posts: 51
theNerd is an unknown quantity at this point
Re: We got Sockets working

Wow. I've been trying to lean how to do that in LabView. Since I switched over to java I still wonder how to do that. Could you explain in detail how you got the comms to work?
Reply With Quote
  #5   Spotlight this post!  
Unread 19-01-2012, 21:17
Patrickwhite's Avatar
Patrickwhite Patrickwhite is offline
May the North be with you
FRC #0610 (The Coyotes)
Team Role: Programmer
 
Join Date: Dec 2008
Rookie Year: 2008
Location: Toronto
Posts: 88
Patrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of light
Re: We got Sockets working

Absolutely that's possible with the SmartDashboard.

The SmartDashboard package is edu.wpi.first.wpilibj.smartdashboard.

Data sent has a name and a value. The name is used to tie a set of values to a certain widget - if you send "Heading" as 90, then set up a widget to listen to that key, then subsequent sendings of "Heading" will go straight to that widget.

You can send booleans, ints, doubles, and Strings, as well as any class that implements SmartDashboardData. You can even make your own SmartDashboardData-implementing class, though doing so is a bit complicated.

You can make your own widget to display data received any way you like.
__________________
while(!going.isTough());
tough.exit();

What will we do tonight, Warfa?
The same thing we do every night, Patrick. Sit and wait for Electrical.

Last edited by Patrickwhite : 19-01-2012 at 21:21.
Reply With Quote
  #6   Spotlight this post!  
Unread 19-01-2012, 21:22
neal's Avatar
neal neal is offline
Neal
FRC #1777 (Viking Robotics)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2009
Location: United States
Posts: 56
neal is an unknown quantity at this point
Re: We got Sockets working

Quote:
Originally Posted by Patrickwhite View Post
Absolutely that's possible with the SmartDashboard.

The SmartDashboard package is edu.wpi.first.wpilibj.smartdashboard.

Data sent has a name and a value. The name is used to tie a set of values to a certain widget - if you send "Heading" as 90, then set up a widget to listen to that key, then subsequent sendings of "Heading" will go straight to that widget.

You can send booleans, ints, doubles, and Strings, as well as any class that implements SmartDashboardData. You can even make your own SmartDashboardData-implementing class, though doing so is a bit complicated.
Oh, cool! I was wondering what putint() and other methods did. But I won't have access to the robot until Saturday. Glad you explained!

How do you make the widgets, though?

Last edited by neal : 19-01-2012 at 21:24.
Reply With Quote
  #7   Spotlight this post!  
Unread 19-01-2012, 22:27
Patrickwhite's Avatar
Patrickwhite Patrickwhite is offline
May the North be with you
FRC #0610 (The Coyotes)
Team Role: Programmer
 
Join Date: Dec 2008
Rookie Year: 2008
Location: Toronto
Posts: 88
Patrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of light
Re: We got Sockets working

http://firstforge.wpi.edu/sf/wiki/do...iki/Extensions

Great set of tutorials on how to write a widget.

The SmartDashboard itself can be downloaded from the same project, under File Releases.
__________________
while(!going.isTough());
tough.exit();

What will we do tonight, Warfa?
The same thing we do every night, Patrick. Sit and wait for Electrical.
Reply With Quote
  #8   Spotlight this post!  
Unread 20-01-2012, 09:50
sand500 sand500 is offline
Registered User
FRC #3540 (Wildcat Robotics)
 
Join Date: Jan 2011
Rookie Year: 2011
Location: United States
Posts: 81
sand500 is an unknown quantity at this point
Re: We got Sockets working

Quote:
Originally Posted by Patrickwhite View Post
Neat!

Your custom dashboard looks a lot like the Smart Dashboard - for what reasons did you decide to make your own, instead of using the Smart Dashboard?
Well we are still messing around at this point, but based on how our bot turns out, we will make our Dashboard to fit the bot.
Reply With Quote
  #9   Spotlight this post!  
Unread 28-01-2012, 19:25
ProgrammerMatt ProgrammerMatt is offline
Programmer-Electrical-Mechanical
FRC #0228 (Gus)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Southington
Posts: 138
ProgrammerMatt is just really niceProgrammerMatt is just really niceProgrammerMatt is just really niceProgrammerMatt is just really nice
Re: We got Sockets working

Mind sharing how to use sockets im trying to send my vision tracking data to our robot with no luck
Reply With Quote
  #10   Spotlight this post!  
Unread 28-01-2012, 20:43
Sunstroke Sunstroke is offline
Programmer
AKA: Joe Grinstead
FRC #3504 (Girls of Steel)
Team Role: Mentor
 
Join Date: Apr 2009
Rookie Year: 2009
Location: New England
Posts: 49
Sunstroke is an unknown quantity at this point
Re: We got Sockets working

Quote:
Originally Posted by ProgrammerMatt View Post
Mind sharing how to use sockets im trying to send my vision tracking data to our robot with no luck
Might I suggest looking at this thread? It takes away all the little obnoxious parts of sockets and does it for you.
Reply With Quote
  #11   Spotlight this post!  
Unread 29-01-2012, 00:10
Sunstroke Sunstroke is offline
Programmer
AKA: Joe Grinstead
FRC #3504 (Girls of Steel)
Team Role: Mentor
 
Join Date: Apr 2009
Rookie Year: 2009
Location: New England
Posts: 49
Sunstroke is an unknown quantity at this point
Re: We got Sockets working

Quote:
Originally Posted by ProgrammerMatt View Post
Mind sharing how to use sockets im trying to send my vision tracking data to our robot with no luck
I would consider using the code provided by WPI.
Reply With Quote
  #12   Spotlight this post!  
Unread 31-01-2012, 15:32
ProgrammerMatt ProgrammerMatt is offline
Programmer-Electrical-Mechanical
FRC #0228 (Gus)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Southington
Posts: 138
ProgrammerMatt is just really niceProgrammerMatt is just really niceProgrammerMatt is just really niceProgrammerMatt is just really nice
Re: We got Sockets working

Quote:
Originally Posted by Sunstroke View Post
I would consider using the code provided by WPI.
The problem with that is i have a program for vision tracking and it sends out TCP data on its own...
Reply With Quote
  #13   Spotlight this post!  
Unread 01-02-2012, 08:35
derekwhite's Avatar
derekwhite derekwhite is offline
Java Virtual Machine Hacker
no team (FIRST@Oracle)
Team Role: Programmer
 
Join Date: May 2009
Rookie Year: 2009
Location: Burlington, MA
Posts: 127
derekwhite is on a distinguished road
Re: We got Sockets working

Here's one quick example:

Code:
// connect to “echo” server:
SocketConnection sc = (SocketConnection) Connector.open("socket://host.com:79");
InputStream is = sc.openInputStream();
OutputStream os = sc.openOutputStream();

os.write("Hello\r\n".getBytes()); 
int ch = 0; 
while(ch != -1) {
   ch = is.read(); 
}
sc.close();
Reply With Quote
  #14   Spotlight this post!  
Unread 01-02-2012, 08:36
derekwhite's Avatar
derekwhite derekwhite is offline
Java Virtual Machine Hacker
no team (FIRST@Oracle)
Team Role: Programmer
 
Join Date: May 2009
Rookie Year: 2009
Location: Burlington, MA
Posts: 127
derekwhite is on a distinguished road
Re: We got Sockets working

More examples here:

http://developers.sun.com/mobility/m.../midp2network/
Reply With Quote
  #15   Spotlight this post!  
Unread 02-02-2012, 17:33
ProgrammerMatt ProgrammerMatt is offline
Programmer-Electrical-Mechanical
FRC #0228 (Gus)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Southington
Posts: 138
ProgrammerMatt is just really niceProgrammerMatt is just really niceProgrammerMatt is just really niceProgrammerMatt is just really nice
Re: We got Sockets working

This is more for derek but when i send data to my robot using this code http://pastebin.com/x2KZepNR that i made i get a thread error and null pointer any ideas?
here is error

Code:
[cRIO] Default disabled() method running, consider providing your own
[cRIO] Uncaught exception in Thread.run():
[cRIO]     on thread Thread-6
[cRIO] java.lang.NullPointerException
[cRIO]     at edu.wpi.first.wpilibj.templates.Socket.run(Socket.java:40)
[cRIO]     in virtual method #47 of com.sun.squawk.VMThread(bci=42)
[cRIO]     in static method #3 of com.sun.squawk.VM(bci=6)

Last edited by ProgrammerMatt : 02-02-2012 at 17:46.
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 11:14.

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