Go to Post We haven't yet been able to find the A-team, but if we do... well, I pity the fool. :) - Madison [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 29-12-2008, 01:41
manderson5192 manderson5192 is offline
Registered User
AKA: Matt Anderson
FRC #0948 (Newport Robotics Group: NRG (pronounced eNeRGy))
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Bellevue, WA
Posts: 62
manderson5192 is on a distinguished road
Trouble modifying WPILib

Hey guys,

I'm setup to program in C++ with WindRiver workbench and I'm able to get all the example programs to compile just fine. I just got started on a new project today, though, trying to modify the WPIlib source files RobotDrive.cpp and RobotDrive.h in my project. I have copied them from the WPIlib project (downloadable from the WPI website) into my project, which is a SimpleRobot.

From reading the C Programming Guide, I assume that one is able to do just this, make modifications to the added WPIlib files, and then everything will magically compile (see page 76 in the guide). Clearly, though, this is not the case (at least in my case ).

As far as I can tell, there are no syntactical errors that would keep my code from compiling, and yet I am still getting errors when I go to build the project. There are four functions that each generate two errors in what appears to be the link step (I may be wrong on that one) and the errors, in essence, say that I have multiple definitions of these four functions. Coincidentally, these are the four functions that I didn't comment out from the original WPIlib files. Their definitions in the .h file did not change, either, to accommodate my modifications.

So here's what I think is happening: I think that my project is somehow trying to link in the pre-compiled RobotDrive files and throwing me errors where ever it finds conflicts between the ones in my project and the ones in WPIlib.

Finally my question: Has anyone tried to modify parts of WPIlib in a new project to any success? What was your secret? I am kinda stumped right now...

Maybe I just need to sleep on it, but if you guys could think of any solution, I would be hugely appreciative.

Thanks!
-Matt
  #2   Spotlight this post!  
Unread 29-12-2008, 01:43
manderson5192 manderson5192 is offline
Registered User
AKA: Matt Anderson
FRC #0948 (Newport Robotics Group: NRG (pronounced eNeRGy))
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Bellevue, WA
Posts: 62
manderson5192 is on a distinguished road
Re: Trouble modifying WPILib

Another development to suggest that the real problem is what I think it is: the line numbers for the errors point to locations in my RobotDrive.cpp file that are completely unrelated to the functions in question. I did a quick check to see if those line numbers corresponded to the WPIlib .cpp files and, lo and behold, they did.

Any solutions?

Thanks again!
-Matt
  #3   Spotlight this post!  
Unread 29-12-2008, 06:14
koreabell koreabell is offline
Team 956 Safety Captain
FRC #0956 (Eagles)
Team Role: Programmer
 
Join Date: Sep 2008
Rookie Year: 2007
Location: Oregon
Posts: 24
koreabell is an unknown quantity at this point
Re: Trouble modifying WPILib

the only thing i can think of is that IDE is not recognizing overloading of functions but i'm not sure on that
  #4   Spotlight this post!  
Unread 29-12-2008, 13:18
manderson5192 manderson5192 is offline
Registered User
AKA: Matt Anderson
FRC #0948 (Newport Robotics Group: NRG (pronounced eNeRGy))
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Bellevue, WA
Posts: 62
manderson5192 is on a distinguished road
Re: Trouble modifying WPILib

I'm pretty sure I'm not overloading any functions...would it help any if I posted up the error output? I'll get to that right now...
  #5   Spotlight this post!  
Unread 29-12-2008, 13:30
tdlrali tdlrali is offline
Registered User
FRC #0469 (Las Guerrillas)
Team Role: Programmer
 
Join Date: Sep 2006
Rookie Year: 2006
Location: MI
Posts: 377
tdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud of
Re: Trouble modifying WPILib

I'm almost certain your problem has to do with the fact that the linker is using the wrong libraries. Right click your Project in the Project Explorer, click Properties. Head over to Libraries under Build Properties, and edit the existing entry of "$(WIND_BASE)/target/lib/WPILib.a" to point to your compiled library.
(This is from page 75 of the C Programming Guide)
  #6   Spotlight this post!  
Unread 29-12-2008, 14:12
manderson5192 manderson5192 is offline
Registered User
AKA: Matt Anderson
FRC #0948 (Newport Robotics Group: NRG (pronounced eNeRGy))
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Bellevue, WA
Posts: 62
manderson5192 is on a distinguished road
Re: Trouble modifying WPILib

I just want to clarify what that will do before I go ahead and do it. I understand that there is a precompiled WPIlib somewhere in the WindRiver directory. I also understand that I can compile the WPIlib from the source files available online on the WPI website to make the same WPIlib.a file that is found in the WindRiver directory after installing WorkBench.

What I want to do is modify just RobotDrive.cpp and RobotDrive.h for my project alone. Is what you're saying that I have to modify the downloadable WPIlib source files, compile that to WPIlib.a, and then include that in my project?

Maybe it's just me, but I thought that page 76 of the C Programming Guide said all I had to do was add the files I wanted to modify to my project directory and compile.

I have no problem with modifying the WPIlib source files in my WPIlib project and then compiling that to a new WPIlib.a, it's just that I think there's another way of doing this.

So, you just pointed out one solution (Thanks!). Does anybody have another? I'll go take another look at page 76, just to make sure I'm not crazy ...
  #7   Spotlight this post!  
Unread 29-12-2008, 16:40
d235j d235j is offline
Registered User
FRC #4454
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Philadelphia, PA
Posts: 25
d235j has a spectacular aura aboutd235j has a spectacular aura about
Re: Trouble modifying WPILib

The problem is that RobotDrive.cpp and RobotDrive.h depend on other source files. Compiling to a new WPILib.a is probably the easiest way to go around this. (Though there are other ways.)
  #8   Spotlight this post!  
Unread 29-12-2008, 16:47
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Trouble modifying WPILib

Just curious -

What modifications do you want to make to those files? Are you sure you aren't better off putting your custom code in a different file?

It may be easier to create a child class and overwrite the functions you want to replace.
  #9   Spotlight this post!  
Unread 29-12-2008, 21:59
manderson5192 manderson5192 is offline
Registered User
AKA: Matt Anderson
FRC #0948 (Newport Robotics Group: NRG (pronounced eNeRGy))
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Bellevue, WA
Posts: 62
manderson5192 is on a distinguished road
Re: Trouble modifying WPILib

Here is a link to a post on made on the USFIRST forums, since the WPI guys tend to read that a little more frequently (http://forums.usfirst.org/showthread...2148#post22148)

Quote:
Just curious -

What modifications do you want to make to those files? Are you sure you aren't better off putting your custom code in a different file?

It may be easier to create a child class and overwrite the functions you want to replace.
The modifications I am making are to support an as-yet unsupported drive type. I would love to explain more about the drive system, but our mechanical team wouldn't be too happy with me .

I'm not really sure what you mean by creating a child class (I'm not exactly a pro with OOP yet, although I have several books I'm learning lots from), but I am interested. It sounds like you are suggesting that I somehow over-rule the function definitions in RobotDrive.cpp and RobotDrive.h. How would you suggest I implement that, if that's what you're talking about?

Thanks!
-Matt
  #10   Spotlight this post!  
Unread 31-12-2008, 03:26
manderson5192 manderson5192 is offline
Registered User
AKA: Matt Anderson
FRC #0948 (Newport Robotics Group: NRG (pronounced eNeRGy))
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Bellevue, WA
Posts: 62
manderson5192 is on a distinguished road
Re: Trouble modifying WPILib

Hey guys. More progress on this topic is being made over on the USFIRST C++ programming forum. Anyone interested in extending/modifying WPILib will probably find it interesting.

Rather than double posting what is on the other forum, this post serves as a bump.

-Matt
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Inventor software trouble/ FIRST Base trouble nasa-senpai General Forum 2 24-01-2007 09:15
modifying parts? firstborn Motors 12 20-01-2006 14:35
Modifying Motors Gun Technical Discussion 2 27-02-2003 15:11
modifying sprockets gail OCCRA 3 05-10-2002 12:13
Modifying Casters Jim Meyer OCCRA 1 05-10-2001 21:15


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

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