|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
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(); ... 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 |
|
#2
|
||||
|
||||
|
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 { } |
|
#3
|
||||
|
||||
|
Re: How To Implement Axis Camera In Iterative Robot
Thanks for the quick reply!
Um, we had it like that. Quote:
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()); Thanks! -Masoug |
|
#4
|
|||
|
|||
|
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); |
|
#5
|
||||
|
||||
|
Re: How To Implement Axis Camera In Iterative Robot
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) |
|
#6
|
||||
|
||||
|
Re: How To Implement Axis Camera In Iterative Robot
Thanks!
Now it compiles, but I have a few questions: Quote:
Code:
function() : another_thing(){}
How does that exactly work? -Masoug |
|
#7
|
|||
|
|||
|
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.
|
|
#8
|
||||
|
||||
|
Quote:
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 |
|
#9
|
||||
|
||||
|
Re: How To Implement Axis Camera In Iterative Robot
Quote:
The GetInstance returns a reference, so it has to be a reference or a pointer |
|
#10
|
||||
|
||||
|
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
{
}
Code:
Relocation value does not fit in 24 bits. Thanks! -Masoug |
|
#11
|
|||||
|
|||||
|
Re: How To Implement Axis Camera In Iterative Robot
A search of the forums for that error message yields a possibly relevant thread.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |