Need help:  API response time fluctuates a lot
Billy Lo from Canada  [5 posts]
4 years
We have a basic .robo code that tracks the 3-point goal.  Most of the time, the time it takes the Java code running in the cRIO to get a response from RoboRealm is pretty quick (avg is 60ms.)  But some times, it goes up to >100ms (18 out of 115 calls), which freezes the robot for too long.

Is there any way to limit the amount of time RoboRealm would wait to finish an API call (e.g. get_variables) from an external client?  (it's ok to give me an error so that I would retry).  Or would you have any suggestions on solving this problem?

Thanks.  I have attached a spreadsheet that shows the distribution of innovation time (measure from the Java side, from sending the request to receiving the response).

timer results 1.zip
Steven Gentner from United States  [1370 posts] 4 years

This is one of the reasons that the Network Tables module was created ... to separate the wait from processing. If you still decide to go the API route, you should be able to change the socket timeout on the CRio such that it returns in 50ms if nothing is received. If this is not possible, we can add a timeout to the api call but this may not be the actual reason (it may be a network hiccup that happens that is outside of RR). Ideally, the Java timeout would be the way to go.

What code are you using on the CRio?

Billy Lo from Canada  [5 posts] 4 years
Hi, STeven,  Sorry for the late response.  We have been pre-occupied by the preparations for our first regional at GSR this weekend.  I am happy to tell you that the boys did well and won GSR.

We use Java ME socket API to make these calls and have not found a way to specify a timeout yet.  We will explore switching to Network Tables when we have a little time after catching up on sleep.


This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index