View Single Post
  #1   Spotlight this post!  
Unread 29-07-2015, 15:34
Ari423's Avatar
Ari423 Ari423 is offline
LabVIEW aficionado and robot addict
AKA: The guy with the yellow hat
FRC #5987 (Galaxia)
Team Role: Mentor
 
Join Date: Mar 2015
Rookie Year: 2012
Location: Haifa, Israel
Posts: 634
Ari423 has much to be proud ofAri423 has much to be proud ofAri423 has much to be proud ofAri423 has much to be proud ofAri423 has much to be proud ofAri423 has much to be proud ofAri423 has much to be proud ofAri423 has much to be proud ofAri423 has much to be proud of
Re: Detecting if the code runs from the PC or the RoboRIO

Quote:
Originally Posted by wt200999 View Post
The only time RUN_TIME_ENGINE is FALSE will be if you are running the code on your host machine. This works if you are using the simulator vs the actual robot, but once you run it on the robot as you describe it will be TRUE. Target_Type and OS will give you the same issue.
I just had an idea. When you get the file path of Robot Main in Robot Main, if it is built and running in the robot project the second to last string in the file path will be projectName.exe, whereas if you were running it in debug mode (manually running Robot Main) the second to last string in the file path will be the folder the project is in. You should be able to get the file path, strip it twice, and search the second stripped string for ".exe". If you are running a build the index will be greater than 0 (it exists somewhere in the string). If it is running in debug mode, the index will be -1 (search string isn't in source string). You can then save this bool as a global, carry it into teleop and/or periodic, or do whatever you want with it. Let me know if this works.

EDIT: I think this is what you are looking for without using any complicated property nodes. There may be other ways to do the same thing using property nodes or otherwise, and you should feel free to use whichever you feel is easier. My original suggestion about removing this code from the final project still stands.
__________________
2017-present: Mentor FRC 5987
2017-present: CSA for FIRST in Israel
2012-2016: Member FRC 423
2013: Programmer
2014: Head Programmer, Wiring
2015: Head Programmer, Wiring
2016: Captain, Head Programmer, Wiring, Manipulator, Chassis, CAD, Business, Outreach (basically everything)



Last edited by Ari423 : 29-07-2015 at 15:37.
Reply With Quote