Go to Post Be thankful for what you have, not frustrated with it because it doesn't exactly suit your needs. - sanddrag [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 24-01-2012, 20:33
grantf's Avatar
grantf grantf is offline
Software Engineering Mentor
FRC #4061 (SciBorgs)
Team Role: Engineer
 
Join Date: Feb 2007
Rookie Year: 2005
Location: Pullman, WA
Posts: 16
grantf has a spectacular aura aboutgrantf has a spectacular aura about
Subsystem::GetName() Doesn't Do What I Expect

Here's some code and expected versus actual results. I'm confident that WPILib would benefit from an update.

The Test Code
Code:
MyRobot::RobotInit()
{
    //
    // The class called "MySubsystem" derives from Subsystem and calls the
    //  parent class constructor, with a Subsystem name of "MySusbsystem"
    //
    Subsystem* p_subsystem = new MySubsystem();

    //
    // This code prints the name of the newly-created subsystem to the
    //  DriverStationLCD.
    //
    DriverStationLCD* p_driver_station_lcd = DriverStationLCD::GetInstance();
    p_driver_station_lcd->PrintfLine(DriverStationLCD::kUser_Line1, "%s", p_subsystem->GetName().c_str() );
    p_driver_station_lcd->UpdateLCD();
}
The Expected Result
After I compile this code and download it to the cRIO, I expect the DriverStationLCD to have a single line of text showing "MySubsystem".

The Actual Result
Instead, I see "Subsystem". If I change the name of the passed-in subsystem name to anything else, I always see "Subsystem" as the returned string.

My Suspicion
Subsystem::GetName() is returning a hard-coded value and not the user-provided name.

Please provide an update to the WPILib that solves this problem
Reply With Quote
  #2   Spotlight this post!  
Unread 24-01-2012, 22:06
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Subsystem::GetName() Doesn't Do What I Expect

Quote:
Originally Posted by grantf View Post
My Suspicion
Subsystem::GetName() is returning a hard-coded value and not the user-provided name.
It is returning a hard-coded value. Here is the source code of the function:
Code:
std::string Subsystem::GetName()
{
        return "Subsystem";
}
__________________
Reply With Quote
  #3   Spotlight this post!  
Unread 24-01-2012, 22:57
grantf's Avatar
grantf grantf is offline
Software Engineering Mentor
FRC #4061 (SciBorgs)
Team Role: Engineer
 
Join Date: Feb 2007
Rookie Year: 2005
Location: Pullman, WA
Posts: 16
grantf has a spectacular aura aboutgrantf has a spectacular aura about
Re: Subsystem::GetName() Doesn't Do What I Expect

Quote:
Originally Posted by mikets View Post
It is returning a hard-coded value. Here is the source code of the function:
Code:
std::string Subsystem::GetName()
{
        return "Subsystem";
}
Indeed, I imagine that the root cause of the issue is that the code from the Subsystem::GetType() method was copy-pasted into the GetName() method - you can see the implementations are the same.

Just in case someone is interested, we implemented a workaround where we simply introduce another intermediate sub-class of Subsystem that extends the GetName() method and returns a local copy of the name. When the WPILib is updated to correct this issue, we will remove our intermediate class.
Reply With Quote
  #4   Spotlight this post!  
Unread 24-01-2012, 23:44
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,562
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Subsystem::GetName() Doesn't Do What I Expect

The fastest way to get this fixed would be to report a bug in the WPILib Tracker and provide a patch.
Reply With Quote
  #5   Spotlight this post!  
Unread 25-01-2012, 01:03
grantf's Avatar
grantf grantf is offline
Software Engineering Mentor
FRC #4061 (SciBorgs)
Team Role: Engineer
 
Join Date: Feb 2007
Rookie Year: 2005
Location: Pullman, WA
Posts: 16
grantf has a spectacular aura aboutgrantf has a spectacular aura about
Re: Subsystem::GetName() Doesn't Do What I Expect

Quote:
Originally Posted by Joe Ross View Post
The fastest way to get this fixed would be to report a bug in the WPILib Tracker and provide a patch.
Thanks for that, but it seems I cannot create an account. That pages gives me a bunch of errors regarding password strength, such as "must have at least one number", "must be at least 6 characters long", etc. I have complied with each and every error message with a new password, and still I cannot get in.

I would gladly contribute a patch, but I simply cannot become a member of the project. Bummer...
Reply With Quote
  #6   Spotlight this post!  
Unread 25-01-2012, 01:05
bob.wolff68's Avatar
bob.wolff68 bob.wolff68 is offline
Da' Mentor Man
FRC #1967
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2007
Location: United States
Posts: 157
bob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nice
Re: Subsystem::GetName() Doesn't Do What I Expect

The password strength requirements are VERY harsh. ALL of these are required in your password:
* Uppercase
* Lowercase
* Numeric
* Non-numeric-non-alphabetic (symbols)

bob
Reply With Quote
  #7   Spotlight this post!  
Unread 25-01-2012, 01:17
grantf's Avatar
grantf grantf is offline
Software Engineering Mentor
FRC #4061 (SciBorgs)
Team Role: Engineer
 
Join Date: Feb 2007
Rookie Year: 2005
Location: Pullman, WA
Posts: 16
grantf has a spectacular aura aboutgrantf has a spectacular aura about
Re: Subsystem::GetName() Doesn't Do What I Expect

Quote:
Originally Posted by bob.wolff68 View Post
The password strength requirements are VERY harsh. ALL of these are required in your password:
* Uppercase
* Lowercase
* Numeric
* Non-numeric-non-alphabetic (symbols)

bob
They certainly are. After applying the Fort-Knox password generator, I'm in. Thanks for that
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 17:42.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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