Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Which programming language does your team use? (http://www.chiefdelphi.com/forums/showthread.php?t=114835)

mlbernardoni 17-03-2013 15:24

Re: Which programming language does your team use?
 
Labview vs C++ responsiveness

Team 2704 has historically used Labview. This year we programmed both Labview and C++. We found C++ much more responsive.

To clarify, we started this year with a simple drive train (we always build the drive train first). It is a 4 wheel design, front wheel drive, omni's in the back. We did a very simple program in Labview, tank drive, 1 joystick on a Game Pad to one drive wheel, the other joystick on the Game Pad to the second drive wheel.

It acted just as we historically expected from our years of using Labview.

We duplicated the simple program in C++ (1 joystick to 1 powered wheel; 2nd joystick to 2nd powered wheel). There was a night and day difference. Like moving up to a Ferrari. The drive team never realized the lag they had gotten use to with Labview. We will have a hard time getting the drive team to go back to Labview.

I don't know what overhead Labview puts on the program. But every student who drives the robot will tell you that there is a big difference, and it was obvious from watching the robot drive.

Same robot, same CRIO, same communications, official 2013 versions of labview and windriver, both very simple programs (1 joystick to 1 motor etc.). The only way to put it, moving the joysick to motor movement on the robot, c++ is much more responsive.

connor.worley 17-03-2013 15:37

Re: Which programming language does your team use?
 
Quote:

Originally Posted by mlbernardoni (Post 1249129)
Labview vs C++ responsiveness

Team 2704 has historically used Labview. This year we programmed both Labview and C++. We found C++ much more responsive.

To clarify, we started this year with a simple drive train (we always build the drive train first). It is a 4 wheel design, front wheel drive, omni's in the back. We did a very simple program in Labview, tank drive, 1 joystick on a Game Pad to one drive wheel, the other joystick on the Game Pad to the second drive wheel.

It acted just as we historically expected from our years of using Labview.

We duplicated the simple program in C++ (1 joystick to 1 powered wheel; 2nd joystick to 2nd powered wheel). There was a night and day difference. Like moving up to a Ferrari. The drive team never realized the lag they had gotten use to with Labview. We will have a hard time getting the drive team to go back to Labview.

I don't know what overhead Labview puts on the program. But every student who drives the robot will tell you that there is a big difference, and it was obvious from watching the robot drive.

Same robot, same CRIO, same communications, official 2013 versions of labview and windriver, both very simple programs (1 joystick to 1 motor etc.). The only way to put it, moving the joysick to motor movement on the robot, c++ is much more responsive.

This seems very unlikely. Are you using the correct speed controller classes in LabVIEW?

apalrd 17-03-2013 15:39

Re: Which programming language does your team use?
 
This still makes no sense. I have never seen the lag you describe. Are you running control tasks too slowly or running up on 100% CPU usage?

Please quantitatively describe the lag and root-cause it before blaming it all on the programming language. The language itself is not a cause for lag, many other factors such as code execution speed and CPU load can result in lag but those are not caused by the programming language.

You can measure robot CPU load in LabVIEW using the RT Get CPU Loads block. I suspect you are running at or near 100% and missing tasks resulting in lag. I am not sure how to measure CPU loads in C++ but I suspect it is possible.

Alan Anderson 17-03-2013 15:47

Re: Which programming language does your team use?
 
Quote:

Originally Posted by mlbernardoni (Post 1249129)
I don't know what overhead Labview puts on the program. But every student who drives the robot will tell you that there is a big difference, and it was obvious from watching the robot drive.

Same robot, same CRIO, same communications, official 2013 versions of labview and windriver, both very simple programs (1 joystick to 1 motor etc.). The only way to put it, moving the joysick to motor movement on the robot, c++ is much more responsive.

Having seen LabVIEW used for very precise control by many teams over many years, I'm not convinced that your experience indicates anything about LabVIEW in general. If you can post your simple programs, I'd like to see if you've done anything that might be causing the LabVIEW one to misbehave. (For example, there could be some simple error in your code which results in a cascade of diagnostic messages to the Driver Station, and those messages are quite capable of interfering with timely communication and control.)

mlbernardoni 17-03-2013 16:10

Re: Which programming language does your team use?
 
That is the point, the programs were very simple and as close to identical as we could possibly program using Labview and C++ FRC required libraries.

We use Victors, all classes in the labview program are based upon the victor motor control block and all classes in C++ are based on the Victor base class in the WPI C++ library. (The victors on the robot go all the way from Red to Green, full power range with each program.)

The CRIO speed is what is set in the WPI base classes. We did not program for that with either C++ or Labview. (As I said, very simple programs using the foundations supplied by FRC and WPI.)

We used the same iterations per second in our C++ code as Labview uses.

Labview was completely compiled and downloaded to the CRIO, no extra communications. And we did not see any errors while running these simple programs.

We did not measure the CPU load, but I find it hard to believe the CPU was pegged with such a simple program.

But I agree with your objection, it comes down to the compiled code on the CPU. I do not know what overhead Labview adds (or for that mater the WPI library), but it is very noticeable on our robot.

We had 2 very very simple programs using the FRC required foundation for C++ and Labview.

As for teams not noticing any lag. Neither did we for the past 5 years. We are not saying that there is any error in Labview. We have successfully used Labview for years. And I will say we have had very complex programs that functioned very well.

Greg McKaskle 17-03-2013 19:05

Re: Which programming language does your team use?
 
What people are pointing out is that your conclusion seems unlikely. If the code runs once every 20ms and uses the correct encoding for the motor controllers, there shouldn't be any measurable difference in driving. If you can think of other causes, then those too can be measured to determine if they differ and contribute to a difference in responsiveness.

Greg McKaskle

mlbernardoni 17-03-2013 19:13

Re: Which programming language does your team use?
 
Try it out yourself and post any different result. As I said, the programs are very simple.

Greg McKaskle 17-03-2013 19:29

Re: Which programming language does your team use?
 
The only explanation is that something was wrong with the LV code or something else changed, like the battery, or driving on linoleum instead of carpet, or another environmental issue.

If you post your LV code, I can easily run it to see what speed it is running at and verify that the speed controllers are being updated properly. Doing my own experiment will convince me, but will it really convince you, or others? It certainly won't if I fail to publish my data and my measurement methods.

Greg McKaskle

Alan Anderson 17-03-2013 21:44

Re: Which programming language does your team use?
 
Quote:

Originally Posted by mlbernardoni (Post 1249259)
Try it out yourself and post any different result. As I said, the programs are very simple.

I've written and run "very simple" tank drive FRC robot programs in both C and LabVIEW. I saw absolutely no difference in performance between them. You'll need to show us the program that you say has poor responsiveness, so we can try it ourselves and try to understand what's wrong with it.

Until I see what you're referring to, I'm not going to guess at what might be at the root of the problem. What I will do is point out something you said that confuses me:

Quote:

Originally Posted by mlbernardoni (Post 1249171)
all classes in the labview program are based upon the victor motor control block

LabVIEW classes are not a typical tool used by FRC teams, they certainly wouldn't be used in a "very simple" program, and I'm not sure you could even base one on the Motor functions. Perhaps you meant something else?

mlbernardoni 18-03-2013 10:04

Re: Which programming language does your team use?
 
Had to check with the team. The sample drive train programs from week 2 of the season are no longer available. We are competing next week and the week after, so too busy to re-create at the moment. Hopefully we will re-create after that.

brennonbrimhall 18-03-2013 17:17

Re: Which programming language does your team use?
 
Java is taught at our school in AP Computer Science, but we also have sponsors that use LabView in robotics applications (GlobalFoundries for their AMHS system).

All three languages are very professional. Bad code will always be bad code no matter what/how/why you program – hence why awesome mentor support is so awesome ;).

davidzz123 08-04-2013 18:44

Re: Which programming language does your team use?
 
My team has used LabView since its foundation. We like the simplicity and the support that First gives to the teams.

We want to learn how to programm the robot in Java.

bulbajackel 08-04-2013 20:36

Re: Which programming language does your team use?
 
Quote:

Originally Posted by brennonbrimhall (Post 1249822)
Java is taught at our school in AP Computer Science, but we also have sponsors that use LabView in robotics applications (GlobalFoundries for their AMHS system).

COMPUTER SCIENCE IN SCHOOL?!?!?! AWESOME! We use Labview though

bs7280 08-04-2013 20:41

Re: Which programming language does your team use?
 
Assembly, because thinks aren't complicated enough.

Just kidding, Java because it is more powerful than labview at times.

tcjinaz 08-04-2013 22:25

Re: Which programming language does your team use?
 
Quote:

Originally Posted by bs7280 (Post 1258962)
Assembly, because thinks aren't complicated enough.

Just kidding, Java because it is more powerful than labview at times.

Let's just start from bare metal. None of this froo froo HLL library-based stuff.


All times are GMT -5. The time now is 22:46.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi