Go to Post a robot is never finished... It can always be redone and improved. - EricVicenti [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
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 10-04-2014, 01:12
DjScribbles DjScribbles is offline
Programming Mentor
AKA: Joe S
FRC #2474 (Team Excel)
Team Role: Mentor
 
Join Date: Oct 2011
Rookie Year: 2012
Location: Niles MI
Posts: 284
DjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to behold
CheesyVision C++ Port

While I don't consider myself an expert on network sockets, especially not in this environment, but I wanted to implement CheesyVision, and haven't seen any mention of C++ ports in progress, so I thought I'd get the ball rolling:

https://github.com/FirstTeamExcel/Ro...sionServer.cpp

I have not tested this at all! I don't expect it to work yet. I'm simply looking for feedback and gauging interest at this point.

I followed the primary interface of the java class, however I believe using the SocketServerStreamProvider class allows a simpler connection management scheme than the java implementation (either that, or I've over-simplified), and I've got a few changes due to the threading method used.

I'm open to any suggestions and, although I'm not extremely familiar with git, I should be able to fumble through any pull requests I get. We are competing at MSC this weekend, so my time to work on this could be limited, but feel free to hunt me down if you are there and interested.

Thanks to Bob Wolff for the extremely handy jankyTask (which is apparently based on some work by Tom Bottglieri of 254, small world )
Reply With Quote
  #2   Spotlight this post!  
Unread 10-04-2014, 19:55
DjScribbles DjScribbles is offline
Programming Mentor
AKA: Joe S
FRC #2474 (Team Excel)
Team Role: Mentor
 
Join Date: Oct 2011
Rookie Year: 2012
Location: Niles MI
Posts: 284
DjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to behold
Re: CheesyVision C++ Port

I had chance to test this today and I can confirm everything works great, the only thing I needed to change is adding variable initialization in the constructor, which caused the counts to be messed up.
Reply With Quote
  #3   Spotlight this post!  
Unread 14-04-2014, 15:21
DjScribbles DjScribbles is offline
Programming Mentor
AKA: Joe S
FRC #2474 (Team Excel)
Team Role: Mentor
 
Join Date: Oct 2011
Rookie Year: 2012
Location: Niles MI
Posts: 284
DjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to behold
Re: CheesyVision C++ Port

As a note, we had a rather mysterious issue with CheesyVision on Saturday, unfortunately I wasn't able to find a root cause, but it appeared that the laptop and robot were not able to communicate for some reason.

It had worked for us all day Friday, but our two matches on Saturday it didn't seem to connect properly, between the two matches I observed the issue in the pits, restarting the Robot did not fix the issue, nor did restarting the cheesy vision script. On a whim, I restarted the laptop, and that seemed to solve the problem in the pits, however it reappeared on the field (and subsequently looked fine in the pits).

Unfortunately, I did my testing rather hurriedly, and cannot be absolutely sure of my observations; I am inclined to think that something with the script was not properly reconnecting after being started in the queue as tethered and reconnecting again through the FMS, however I'm not sure anything changed in the drive-team's setup process, so it remains a mystery.
Reply With Quote
  #4   Spotlight this post!  
Unread 14-04-2014, 17:35
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,187
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: CheesyVision C++ Port

If you make a pull request with some C++ server example code (one that teams can just drop in) to the CheesyVision github repo, I will merge it.

You can put it in a new folder here: https://github.com/Team254/CheesyVis...aster/examples
Reply With Quote
  #5   Spotlight this post!  
Unread 18-04-2014, 12:19
DjScribbles DjScribbles is offline
Programming Mentor
AKA: Joe S
FRC #2474 (Team Excel)
Team Role: Mentor
 
Join Date: Oct 2011
Rookie Year: 2012
Location: Niles MI
Posts: 284
DjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to behold
Re: CheesyVision C++ Port

The probable source of the problems I described above was identified last night buy the astute observers on team 254.

In the original source code above has a "sleep(50);" within the run loop, the intent is for this to be a 50ms sleep, however the sleep routine in vxworks takes an integer parameter of seconds (rather than milliseconds); so upon reaching the end of the stream, or losing connection, a 50 second sleep is initiated.

To resolve this, the sleep can be changed to Wait(0.05);

This is fixed here: https://github.com/FirstTeamExcel/Ro...sionServer.cpp

They also noted a few other issues that I have not yet fixed:
Data corruption due to multi-threaded access to the status/count values. To fix this, a lock needs to be employed around the count and status values when updating and reading.

HasClientConnection the logic here is incomplete (it should check against the timeout time defined above) and also fails to lock _lastHeartbeatTime
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 06:17.

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