|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Changing parameters on the fly?
This is really big news that I believe VERY few people know of...if I have 'external' access (on the fly) to my program's variables in an interpretive way, well...the possibilities are HUGE.
I'll be trying this with my programmers tomorrow for sure! bob - Team 1967 Mentor - The Janksters |
|
#2
|
||||
|
||||
|
Re: Changing parameters on the fly?
Quote:
We use this all the time: to turn on/off the collection of data, play with operating params (like PID constants), enable/disable features while debugging etc. It definitely works! Good luck! |
|
#3
|
|||
|
|||
|
Re: Changing parameters on the fly?
I personally use LV, so this problem is trivial for us, but would it be possible to have a CSV file stored on the robot that it reads from? So that if you modify the values, it's behavior will change?
|
|
#4
|
||||
|
||||
|
Re: Changing parameters on the fly?
Quote:
Quote:
|
|
#5
|
||||
|
||||
|
Re: Changing parameters on the fly?
Quote:
Code:
in your C++ code:
extern "C" {
typedef struct _PIDConst
{
float Kp;
float Ki;
float Kd;
} PIDConst;
PIDConst iMyPidGain;
}
then from the VxWorks shell:
% iMyPidGain.Kp = 0.001
|
|
#6
|
||||
|
||||
|
Re: Changing parameters on the fly?
No - can't do that directly. The interpreter does not have the benefit of things the compiler/preprocessor would know. Constants are also of no use. If you know the offsets into the structure you can do it manually with the memory modify commands. HTH |
|
#7
|
|||
|
|||
|
Re: Changing parameters on the fly?
Wow - I just tried it and it certainly works. Really cool.
If only there was an inverse of c++filt... The debugger also provides a nice way to do this, but with more complex multithreaded applications debugging's bound to get tricky... SmartDashboard is the future though. Once they can actually get it working, that is ![]() |
|
#8
|
|||
|
|||
|
Re: Changing parameters on the fly?
We do this all the time. We have many variables that we can adjust all the time.
you can see the code as part of our 2010 code. http://www.frc272.com/seminar/Archive/. We call the LCConfig.cpp. You can change the config file, save it via FTP to the Crio, press a button and have it read in to the running code then have it apply the new settings. Once you like them leave it there. The config is read in when we boot up. Very flexible. |
|
#9
|
||||
|
||||
|
Re: Changing parameters on the fly?
Well - we gave a shot at the interactive input on SmartDashboard with no luck. It all works on a separate computer as we've all noted, but otherwise...sigh. We tried to also put a button on the SmartDashboard so we could interactively click on the button ... no go...
So, SmartDashboard::GetInstance()->GetDouble() doesn't work... so we use GetString() and then sscanf() to turn it into a double. Also, using Preferences::GetInstance()->PutString() doesn't work, but PutDouble() and PutInt() work just fine. bob |
|
#10
|
||||
|
||||
|
Re: Changing parameters on the fly?
You should check out the SendablePIDController, which is part of the SmartDashboard. I'm not sure if it works in C++ because of the double issue... but it works for me in python
![]() And, before there was SmartDashboard, there was WebDMA, which does the same thing as SmartDashboard except with a webserver on your robot. ![]() |
|
#11
|
|||
|
|||
|
Re: Changing parameters on the fly?
Quote:
http://firstforge.wpi.edu/sf/tracker....wpilib_c_bugs Thanks, -Joe |
|
#12
|
||||
|
||||
|
Re: Changing parameters on the fly?
Joe,
Thanks for the link to the trackers -- I filed 3 for: - SmartDashboard::GetDouble() doesn't work for interactive data. - Preferences: utString() doesn't work at all- SmartDashboard: utInt() graphs/logs an incorrect (huge) value once in a blue moon causing graphs to become unreadable until the errant data-point scrolls off the graph.Bob Wolff Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|