Go to Post If we succeed, we succeed as a team if we fail, we fail as a team but either way, we are a team - we go home together and celebrate our accomplishments, whatever they are and try to learn from our mistakes. - KenWittlief [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 25-08-2010, 22:34
masoug's Avatar
masoug masoug is offline
Food Consumer
FRC #0114
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Planet Earth
Posts: 78
masoug is an unknown quantity at this point
Question How To Implement Axis Camera In Iterative Robot

Hi,
I am trying to implement the AxisCamera class into our Iterative Robot method, but unfortunately, the AixsCamera class has a difficult time initializing properly. We currently have:

Code:
...
AxisCamera* camera;
camera = &AxisCamera::GetInstance();
...
Is this how we can initialize it besides:

Code:
AxisCamera &camera = AxisCamera::GetInstance();
?

I am pretty novice to all this allocation and stuff, so I would love to have any sort of feedback!

Thanks!

-Masoug
__________________

JabbaScript
Reply With Quote
  #2   Spotlight this post!  
Unread 26-08-2010, 10:36
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: How To Implement Axis Camera In Iterative Robot

Do you have it just like that? or do you have the variable declared up top?

class yourRobotClass: public iterativebot
{
AxisCamera &camera;//declare here

public:
yourRobotClass()://constructor
camera(AxisCamera::GetInstance())//init here
{
}
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
Reply With Quote
  #3   Spotlight this post!  
Unread 26-08-2010, 13:03
masoug's Avatar
masoug masoug is offline
Food Consumer
FRC #0114
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Planet Earth
Posts: 78
masoug is an unknown quantity at this point
Re: How To Implement Axis Camera In Iterative Robot

Thanks for the quick reply!
Um, we had it like that.
Quote:
AxisCamera &camera;//declare here
isn't that the same as
Code:
 AxisCamera* camera;
?
Sorry, I am not that familiar with C++ pointers and addresses...

Can you also explain your code a little more clearly? E.G.
Code:
 camera(AxisCamera::GetInstance());
isn't the constructor private?

Thanks!

-Masoug
__________________

JabbaScript
Reply With Quote
  #4   Spotlight this post!  
Unread 26-08-2010, 16:51
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Re: How To Implement Axis Camera In Iterative Robot

constructors are public (in every program I've seen)

The & makes the variable camera a reference. A reference is similar to a pointer, however once it it set it cannot be changed, and it acts like a non-pointer variable after being set (Use the . operator to access funtions instead of -> )

The camera(AxisCamera::GetInstance()); sets the camera reference to the global AxisCamera object. From that point on if you want to do something like get an image the code is camera.GetImage(imageVar);
__________________

"To have no errors would be life without meaning. No strugle, no joy"
"A network is only as strong as it's weakest linksys"
Reply With Quote
  #5   Spotlight this post!  
Unread 27-08-2010, 15:40
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: How To Implement Axis Camera In Iterative Robot

Quote:
Originally Posted by Radical Pi View Post
constructors are public
not always, but at least one is usually available: the copy constructor (which is used here)
.net has quite a few classes that don't have public constructors (like Graphics)
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
Reply With Quote
  #6   Spotlight this post!  
Unread 28-08-2010, 02:24
masoug's Avatar
masoug masoug is offline
Food Consumer
FRC #0114
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Planet Earth
Posts: 78
masoug is an unknown quantity at this point
Re: How To Implement Axis Camera In Iterative Robot

Thanks!
Now it compiles, but I have a few questions:
Quote:
yourRobotClass()://constructor
camera(AxisCamera::GetInstance())//init here
what does
Code:
function() : another_thing(){}
really do? Is it like a class, where function() "inherits" another_thing()?
How does that exactly work?

-Masoug
__________________

JabbaScript
Reply With Quote
  #7   Spotlight this post!  
Unread 28-08-2010, 11:43
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Re: How To Implement Axis Camera In Iterative Robot

No inheritance here. another_thing is a variable defined somewhere else. It gets set with the value in the parentheses when the function is called.
__________________

"To have no errors would be life without meaning. No strugle, no joy"
"A network is only as strong as it's weakest linksys"
Reply With Quote
  #8   Spotlight this post!  
Unread 28-08-2010, 17:12
masoug's Avatar
masoug masoug is offline
Food Consumer
FRC #0114
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Planet Earth
Posts: 78
masoug is an unknown quantity at this point
Question Re: How To Implement Axis Camera In Iterative Robot

Quote:
Originally Posted by Radical Pi View Post
No inheritance here. another_thing is a variable defined somewhere else. It gets set with the value in the parentheses when the function is called.
So then how is that different than
Code:
camera = AxisCamera::GetInstance()
?

I heard about "initialization list", but what/why is this a case to use it? What about AxisCamera class that it has to bee initialized as a reference?

Thanks!

-Masoug
__________________

JabbaScript
Reply With Quote
  #9   Spotlight this post!  
Unread 29-08-2010, 20:51
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: How To Implement Axis Camera In Iterative Robot

Quote:
Originally Posted by masoug View Post
So then how is that different than
Code:
camera = AxisCamera::GetInstance()
?

I heard about "initialization list", but what/why is this a case to use it? What about AxisCamera class that it has to bee initialized as a reference?

Thanks!

-Masoug
references can only point to one thing in there life, and you must set it at the very beginning. If you'd used a pointer, you could do that, since pointers can point to many things in their life

The GetInstance returns a reference, so it has to be a reference or a pointer
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
Reply With Quote
  #10   Spotlight this post!  
Unread 01-09-2010, 20:25
masoug's Avatar
masoug masoug is offline
Food Consumer
FRC #0114
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Planet Earth
Posts: 78
masoug is an unknown quantity at this point
Re: How To Implement Axis Camera In Iterative Robot

We still have the same problem, when I implement it in the method:
Code:
class yourRobotClass: public iterativebot
{
AxisCamera &camera;//declare here

public:
yourRobotClass()://constructor
camera(AxisCamera::GetInstance())//init here
{
}
the robot code will not work, complaining that:
Code:
Relocation value does not fit in 24 bits.
is there another problem that come along with the camera class?

Thanks!

-Masoug
__________________

JabbaScript
Reply With Quote
  #11   Spotlight this post!  
Unread 01-09-2010, 22:04
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: How To Implement Axis Camera In Iterative Robot

Quote:
Originally Posted by masoug View Post
Code:
Relocation value does not fit in 24 bits.
A search of the forums for that error message yields a possibly relevant thread.
Reply With Quote
  #12   Spotlight this post!  
Unread 08-09-2010, 21:26
masoug's Avatar
masoug masoug is offline
Food Consumer
FRC #0114
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Planet Earth
Posts: 78
masoug is an unknown quantity at this point
Re: How To Implement Axis Camera In Iterative Robot

I checked and "-mlongcall" was already there and the cRIO still complains about "Relocation value does not fit in 24 bits."
Is there any other thing we can do?

Thanks!

-Masoug
__________________

JabbaScript
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Iterative Robot Template? jalburty C/C++ 4 08-04-2011 13:57
Java/Netbeans Camera Code for Classmate PC and Axis Camera joshholat Programming 1 23-01-2010 14:59
Iterative Robot demo mandrews281 C/C++ 0 21-03-2009 15:45
Dashboard and Robot main with Axis camera Team2883 General Forum 9 10-01-2009 07:35
Please Help, Don't Know How to Implement Tank Drive in LabView CVassos NI LabVIEW 5 24-12-2008 16:55


All times are GMT -5. The time now is 03:25.

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