Go to Post Life isn't fair. There's always luck involved. Welcome to the real world. :) - Exla357 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
  #16   Spotlight this post!  
Unread 30-08-2014, 18:34
yash101 yash101 is offline
Curiosity | I have too much of it!
AKA: null
no team
 
Join Date: Oct 2012
Rookie Year: 2012
Location: devnull
Posts: 1,191
yash101 is an unknown quantity at this point
Re: FRC Java TCP client

I am actually now going to use a web server. Since I am using dclib, a web server is a no-brainer and only requires like 5 lines of code! I think I'll use the HttpClient in the cRIO from there! That should work just perfectly. It is the lag that I think of, though

The nice thing, however, is that I can now send POST messages and "inject" values into the serve table. If one table is not good enough, I can also spawn multiple servers with multiple ports too!
  #17   Spotlight this post!  
Unread 01-09-2014, 15:29
JesseK's Avatar
JesseK JesseK is online now
Expert Flybot Crasher
FRC #1885 (ILITE)
Team Role: Mentor
 
Join Date: Mar 2007
Rookie Year: 2005
Location: Reston, VA
Posts: 3,704
JesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond repute
Re: FRC Java TCP client

A web server could be interesting. We just got done experimenting with algorithmic JSON interpretation at work, and it is really promising for fast network comms.
  #18   Spotlight this post!  
Unread 01-09-2014, 15:46
yash101 yash101 is offline
Curiosity | I have too much of it!
AKA: null
no team
 
Join Date: Oct 2012
Rookie Year: 2012
Location: devnull
Posts: 1,191
yash101 is an unknown quantity at this point
Re: FRC Java TCP client

I think I am just about done! I have even written a web interface, so the drivers can access the stored variables! It is really fast too and uses 0.7% CPU of one core on my i3 1.4GHz.
I have attached some screenshots. Also, I use a RAM cache (which is written in STL), so page loads are almost instant!

The code (as usual), is in my GitHub "Other" repositiory, here

I also have my server up at the moment, here.
Attached Thumbnails
Click image for larger version

Name:	monitor-tbl.png
Views:	31
Size:	82.3 KB
ID:	17275  Click image for larger version

Name:	inject-page.png
Views:	26
Size:	85.7 KB
ID:	17276  Click image for larger version

Name:	startpage.png
Views:	28
Size:	154.7 KB
ID:	17277  Click image for larger version

Name:	cmdinterface.png
Views:	22
Size:	67.9 KB
ID:	17278  
  #19   Spotlight this post!  
Unread 01-09-2014, 16:28
orangelight's Avatar
orangelight orangelight is online now
Registered User
AKA: Alex
FRC #0548 (Robostangs)
Team Role: Programmer
 
Join Date: Feb 2014
Rookie Year: 2014
Location: Northville
Posts: 168
orangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to behold
Re: FRC Java TCP client

Quote:
Originally Posted by yash101 View Post
I think I am just about done! I have even written a web interface, so the drivers can access the stored variables! It is really fast too and uses 0.7% CPU of one core on my i3 1.4GHz.
I have attached some screenshots. Also, I use a RAM cache (which is written in STL), so page loads are almost instant!

The code (as usual), is in my GitHub "Other" repositiory, here

I also have my server up at the moment, here.
Looks cool, I may look into HTTP servers after I get done with what I want todo with my TCP one.
__________________


  #20   Spotlight this post!  
Unread 01-09-2014, 16:51
yash101 yash101 is offline
Curiosity | I have too much of it!
AKA: null
no team
 
Join Date: Oct 2012
Rookie Year: 2012
Location: devnull
Posts: 1,191
yash101 is an unknown quantity at this point
Re: FRC Java TCP client

The web server implementation was extremely simple. If you noticed, I am using DLib. DLib adds some of the simplest socket APIs you could imagine!

PHP Code:
class web_server : public server_http
{
    const 
std::string on_request(const incoming_thingsincomingoutgoing_thingsoutgoing)
    {
        return 
"<html><body><h1>Hello World!</h1></body></html>";
    }
}; 
I used this, plus a bunch of HTML + CSS + JavaScript skills to make this. I think I should make a new thread about this software because it is something that many teams might want for communications. The main problem is speed, but it has an extremely vast feature set!
  #21   Spotlight this post!  
Unread 01-09-2014, 19:23
orangelight's Avatar
orangelight orangelight is online now
Registered User
AKA: Alex
FRC #0548 (Robostangs)
Team Role: Programmer
 
Join Date: Feb 2014
Rookie Year: 2014
Location: Northville
Posts: 168
orangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to behold
Re: FRC Java TCP client

I was thinking about making android apps for my team to do debugging and testing next year. But I don't know what the delay should be for the client to ask the robot server for information about sensors and motors.
__________________



Last edited by orangelight : 01-09-2014 at 21:37.
  #22   Spotlight this post!  
Unread 01-09-2014, 23:33
yash101 yash101 is offline
Curiosity | I have too much of it!
AKA: null
no team
 
Join Date: Oct 2012
Rookie Year: 2012
Location: devnull
Posts: 1,191
yash101 is an unknown quantity at this point
Re: FRC Java TCP client

It ends up that my program is designed flexibly so you can run it on any device with a web browser. It requires HTML5 for some nifty features, though. However, I have designed it for webkit-based devices because cross-browser adds tons of unnecessary code when adding display things, like animations, visual ques, etc.


I just generated a CMakeLists.txt, so just copy-and-paste the code into your platform, run make clean, cmake ., and then make! You can then run the project. I also have removed a great portion of DLib functionality because it is unnecessary! I kept getting X11 errors because I didn't link it. However, I was using the preprocessor to not compile that code, so I don't know what is up with that!

I am still developing this appication. However, if you want to download and compile it in Linux, here's my compile script:
PHP Code:
$~ wget https://github.com/yash101/Other/raw/master/DLib/DevNodeServer/DevServer2/CMAKE_STANDALONE/install.sh && chmod +x install.sh && ./install.sh 
To change the port number, use the install script. Enter the folder dserv/src. Edit config.hpp, and change the PORTNO definition to your favorite port!

Enjoy! I will roll out Java and C++ APIs when I have the ability to test them!
Closed Thread


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 22:21.

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