![]() |
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. |
Re: Which programming language does your team use?
Quote:
|
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. |
Re: Which programming language does your team use?
Quote:
|
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. |
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 |
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.
|
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 |
Re: Which programming language does your team use?
Quote:
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:
|
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.
|
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 ;). |
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. |
Re: Which programming language does your team use?
Quote:
|
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. |
Re: Which programming language does your team use?
Quote:
|
| 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