Quote:
Originally Posted by wt200999
I would be interested in seeing the data behind this claim, or some type of metric. Do you have a side by side comparison of the raw speed for various algorithms? I would assume all three languages would be nearly identical since they all call the same functions. Honestly I would expect Java to be the slowest since it has to run on the JVM level compared to C++/LabVIEW which are both compiled to assembly with many optimizations along the way.
|
That line was meant for writing speed, not execution speed.
Although, I know I have 3 CRIOs on hand to do vision processing, though I don't have any of the development software for LV. I'd be interested to see a speed test too. Guessing the fact that its Java ME and not SE, the order would probably be Labview > C++ > Java (but the times will be remarkably similar, as the C++ and Java vision libraries simply uproot to the LV libraries)
Quote:
|
Knowing what functions you want and using Quick Drop I would imagine is close in speed to typing the name out in Java. Also the percent of time spent on actually writing code vs debugging is an important factor.
|
BinaryImage dilateImage = NIVision.dilate(threshholdImage, 3);
theres only so many functions to use.
Of course, this is an opinionated topic. Even so, I can't imagine doing something like our team's 2014 code in LV. We have 5011* lines spread along 31* files and selecting each of their functions individually is a pain, not to mention that our auton system is a vectorized system of quadruple key-value pairs generated from binary information read from files on the cRIO.
Quote:
|
Should every team be reinventing the wheel each year? Most teams use the same type of algorithm, which is what the targeting system has been designed for. The example vision code is a good starting point and having a working vision algorithm is a big accomplishment for many teams. We don't all have to dive into OpenCV on a BeagleBone to track the retro reflective tape.
|
Petoskey Paladins won an award for an OpenCV Raspberry PI :O no idea what a BeagleBone is
I agree that not every team should be doing what the Paladins did but spoonfeeding the entire code to the programmer doesn't really teach him anything.
E/ Here's a snippet of code that took me a half hour to write in Java (few more to tune) and wouldn't even dare writing in LV
Code:
public void execute()
{
if(!init){
loopTimer.start();
loopTimer.reset();
init = true;
}
if(finished) return;
SmartDashboard.putNumber("loopTimer", loopTimer.get());
int numOfRunningCommands = 0; //Used to make sure that it still has commands to be run and doesn't loop forever
long nestedIfs = 0;
long nestedIfFalse = 0;
long nestedIfTrue = 0;
long nestedPauseStop = 0;
long nestedPause = 0;
Enumeration runningCommandsIteration = storageVector.elements(); //List of objects in the storage hashtable
Structure nextCommand; //Temporary storage for the next object in the hash
while(runningCommandsIteration.hasMoreElements()){
nextCommand = (Structure)(runningCommandsIteration.nextElement()); //Retrieves the next element Object and typecasts it to TimedCommnad
if(nextCommand.conditionalStatus != 0)
{
Conditional cond = (Conditional)nextCommand.command;
switch(nextCommand.conditionalStatus)
{
case Structure.conditionalPause:
nestedPause++;
break;
case Structure.conditionalEndPause:
if(nestedPauseStop >> (nestedPause - 1) == 1)
{
loopTimer.stop();
loopTimerStopped = true;
return;
}else{
nestedPause--;
nestedPauseStop = nestedPauseStop &~ (1 << nestedPause);
if(loopTimerStopped && nestedPauseStop == 0)
{
loopTimer.start();
loopTimerStopped = false;
}
}
break;
case Structure.conditionalWhile:
if(nestedIfFalse == 0 //No nested if false?
&& !nextCommand.finished //Not finished?
&& nextCommand.start < loopTimer.get() //Time is proper?
&& !cond.shouldRun(file)){ //Run the command. If it pauses, than pause everything else.
numOfRunningCommands++;
nestedPauseStop = nestedPauseStop | (1 << (nestedPause-1));
}else if(!nextCommand.finished && //Else if it should've run but didnt the command returned false
nextCommand.start < loopTimer.get()){ //so disable the while.
nextCommand.finished = true;
}else{
}
break;
case Structure.conditionalIf:
if(!cond.shouldRun(file))
{
nestedIfFalse = nestedIfFalse | (1 << nestedIfs);
}else{
nestedIfTrue = nestedIfTrue | (1 << nestedIfs);
}
nestedIfs++;
break;
case Structure.conditionalEndIf:
nestedIfFalse = nestedIfFalse &~ (1 << (nestedIfs - 1)); //removes the bit from nestedIfFalse
nestedIfTrue = nestedIfTrue &~ (1 << (nestedIfs - 1));
nestedIfs--;
break;
case Structure.conditionalElse:
/*if(nestedIfFalse >> (nestedIfs - 1) == 1)
{
nestedIfFalse = nestedIfFalse &~ (1 << (nestedIfs - 1));
}else{
nestedIfFalse = nestedIfFalse | (1 << (nestedIfs-1));
}*/
break;
case Structure.conditionalElseIf:
if(nestedIfTrue >> (nestedIfs - 1) == 0){ ///making sure that another else wasn't returned.
if(nestedIfFalse >> (nestedIfs - 1) == 1)
{
if(cond.shouldRun(file))
{
nestedIfFalse = nestedIfFalse &~ (1 << (nestedIfs - 1));
nestedIfTrue = nestedIfTrue | (1 << (nestedIfs - 1));
}
}else if(nestedIfFalse >> (nestedIfs - 1) == 0){
nestedIfFalse = nestedIfFalse | (1 << (nestedIfs-1));
}
}else{
nestedIfFalse = nestedIfFalse | (1 << (nestedIfs-1));
}
break;
default:
System.out.println("[AUTON] Conditional type passed that does not exist. O.O");
}
}else if(nestedIfFalse == 0 //no false if statements
&& loopTimer.get() < nextCommand.timeout + nextCommand.start){ //within time frame
if(loopTimer.get() > nextCommand.start){ //if the command should be running,
if(nextCommand.command == null)
{
System.out.println("[AUTON] Null Command Passed! Woops. How'd that happen? Report to Jake");
}else{
nextCommand.command.execute(file);
numOfRunningCommands += 1;
}
nextCommand.hasStarted = true;
}else{ //else, the command would be running but it hasn't met its start point so the tcg should still run because it hasnt run that command yet
numOfRunningCommands += 1;
}
}else if(nextCommand.hasStarted && !nextCommand.hasRunFinale && nextCommand.timeout + nextCommand.start < loopTimer.get()){
nextCommand.hasRunFinale = true;
if(nextCommand.command != null)
{
nextCommand.command.end();
}
}
}
if(numOfRunningCommands == 0)
{
finished = true; //If theres no commands left, exit
}
}
E/ Just noticed your signature. Of course you cant diss LV when you're getting paid to write it!