By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,805 Members | 1,273 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,805 IT Pros & Developers. It's quick & easy.

Program structure problems

P: n/a
I am doing research on a vision based real-time motion control
system.
The software aspect I will develop was based on windows XP and visual
studio6.

The project has three parts.
The main windows frame as a GUI window. image processing and motor
controling.

Image capture:
I have designed a thread with high priority to let the image data
transfer from the camera. The image capture thread is a static
function of the CMainFrame( the class maintain the GUI). I designed a
class named CimagePorcess to track some objects on the images captured
continuesly.

Then I create a class named CmotorControl to communicate the motor
driver for control the movement.

My question is how these two class communicate with each other. eg.
when I finished the image processing procedure. How can I acesss the
instant of CmotorControl. Should I use "friend".
Should the two instant be the member of the CMainFrame member
varilables or be global.

I'm puzzled...
I'd be appreciate with your advice.

Jun 18 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Asm23 wrote:
I am doing research on a vision based real-time motion control
system.
The software aspect I will develop was based on windows XP and visual
studio6.

The project has three parts.
The main windows frame as a GUI window. image processing and motor
controling.

Image capture:
I have designed a thread with high priority to let the image data
transfer from the camera. The image capture thread is a static
function of the CMainFrame( the class maintain the GUI). I designed a
class named CimagePorcess to track some objects on the images captured
continuesly.

Then I create a class named CmotorControl to communicate the motor
driver for control the movement.

My question is how these two class communicate with each other. eg.
when I finished the image processing procedure. How can I acesss the
instant of CmotorControl. Should I use "friend".
Should the two instant be the member of the CMainFrame member
varilables or be global.
<sarcasm>
Have you heard of question marks? (You know, the symbol '?', like
after the previous sentence) They designate questions in English,
you know. So that others understand that you're actually asking
about something.
</sarcasm>
I'm puzzled...
I'd be appreciate with your advice.
I believe you're starting from the wrong end. Do you have an Entity
Relationship Diagram of your system? Do you have a Data Flow Diagram?
Do you have any design whatsoever?

Don't start by writing low-level code (although for some people it's
the most fun-filled portion). Start by understanding the interaction
between parts. Like, who creates all those objects (Window, Motor
control, Image Processor, and so on). Perhaps the same entity should
organize their interaction (without the need for them to know about
each other)...

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 18 '07 #2

P: n/a
"Asm23" writes:
>I am doing research on a vision based real-time motion control
system.
The software aspect I will develop was based on windows XP and visual
studio6.

The project has three parts.
The main windows frame as a GUI window. image processing and motor
controling.

Image capture:
I have designed a thread with high priority to let the image data
transfer from the camera. The image capture thread is a static
function of the CMainFrame( the class maintain the GUI). I designed a
class named CimagePorcess to track some objects on the images captured
continuesly.

Then I create a class named CmotorControl to communicate the motor
driver for control the movement.

My question is how these two class communicate with each other. eg.
when I finished the image processing procedure. How can I acesss the
instant of CmotorControl. Should I use "friend".
Should the two instant be the member of the CMainFrame member
varilables or be global.
I warn you there is a lot of what you said that I didn't bother to try to
understand. By all means use friend classes to communicate between the two
instances. Conventional wisdom is "never use global variables". But you
can probably avoid a certain amount of clutter in the code by doing so, and
the thought police are unlikely to know about you and your project..
Jun 18 '07 #3

P: n/a
On 6 18 , 9 19 , "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
Asm23 wrote:
I am doing research on a vision based real-time motion control
system.
The software aspect I will develop was based on windows XP and visual
studio6.
The project has three parts.
The main windows frame as a GUI window. image processing and motor
controling.
Image capture:
I have designed a thread with high priority to let the image data
transfer from the camera. The image capture thread is a static
function of the CMainFrame( the class maintain the GUI). I designed a
class named CimagePorcess to track some objects on the images captured
continuesly.
Then I create a class named CmotorControl to communicate the motor
driver for control the movement.
My question is how these two class communicate with each other. eg.
when I finished the image processing procedure. How can I acesss the
instant of CmotorControl. Should I use "friend".
Should the two instant be the member of the CMainFrame member
varilables or be global.

<sarcasm>
Have you heard of question marks? (You know, the symbol '?', like
after the previous sentence) They designate questions in English,
you know. So that others understand that you're actually asking
about something.
</sarcasm>
I'm puzzled...
I'd be appreciate with your advice.

I believe you're starting from the wrong end. Do you have an Entity
Relationship Diagram of your system? Do you have a Data Flow Diagram?
Do you have any design whatsoever?

Don't start by writing low-level code (although for some people it's
the most fun-filled portion). Start by understanding the interaction
between parts. Like, who creates all those objects (Window, Motor
control, Image Processor, and so on). Perhaps the same entity should
organize their interaction (without the need for them to know about
each other)...

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask- -

- -
Thanks for your advice. Really I'm not a native english speaker, and
This is my first post on the news groups. I'm sorry to foget some "?"
in my post. I'll try to increase my writing ability.

Jun 19 '07 #4

P: n/a
On Jun 18, 8:07 pm, Asm23 <Asmwarr...@gmail.comwrote:
I am doing research on a vision based real-time motion control
system.
The software aspect I will develop was based on windows XP and visual
studio6.
Don't use MSVC 6 unless you absolutely have no choice. MFC is not very
nice to work with either. Either of the two newer releases (.NET 2003
and .NET 2005) are much better compilers and you'll have far less
problems - they have native code C++ compilers so you're not forced to
use .NET.
>
The project has three parts.
The main windows frame as a GUI window. image processing and motor
controling.

Image capture:
I have designed a thread with high priority to let the image data
transfer from the camera. The image capture thread is a static
function of the CMainFrame( the class maintain the GUI). I designed a
class named CimagePorcess to track some objects on the images captured
continuesly.
Shared state threading is hard to do and get right. If you can design
it around message passing it will make this much easier to get right.
Think about it as if you had two separate programs sharing as little
as possible.
>
Then I create a class named CmotorControl to communicate the motor
driver for control the movement.

My question is how these two class communicate with each other. eg.
when I finished the image processing procedure. How can I acesss the
instant of CmotorControl. Should I use "friend".
Should the two instant be the member of the CMainFrame member
varilables or be global.
These are very low level questions to be thinking about right now. The
right answer should become more obvious when you try to block out the
overall solution.
K

Jun 19 '07 #5

P: n/a
On 6 19 , 1 12 , Kirit Sælensminde <kirit.saelensmi...@gmail.com>
wrote:
On Jun 18, 8:07 pm, Asm23 <Asmwarr...@gmail.comwrote:
I am doing research on a vision based real-time motion control
system.
The software aspect I will develop was based on windows XP and visual
studio6.

Don't use MSVC 6 unless you absolutely have no choice. MFC is not very
nice to work with either. Either of the two newer releases (.NET 2003
and .NET 2005) are much better compilers and you'll have far less
problems - they have native code C++ compilers so you're not forced to
use .NET.
The project has three parts.
The main windows frame as a GUI window. image processing and motor
controling.
Image capture:
I have designed a thread with high priority to let the image data
transfer from the camera. The image capture thread is a static
function of the CMainFrame( the class maintain the GUI). I designed a
class named CimagePorcess to track some objects on the images captured
continuesly.

Shared state threading is hard to do and get right. If you can design
it around message passing it will make this much easier to get right.
Think about it as if you had two separate programs sharing as little
as possible.
Then I create a class named CmotorControl to communicate the motor
driver for control the movement.
My question is how these two class communicate with each other. eg.
when I finished the image processing procedure. How can I acesss the
instant of CmotorControl. Should I use "friend".
Should the two instant be the member of the CMainFrame member
varilables or be global.

These are very low level questions to be thinking about right now. The
right answer should become more obvious when you try to block out the
overall solution.

K
Thanks, my application have so high speed (it's about 100 frames/
second) that I have to use the critical section to seperate the image
capture thread and the image process thread. I wonder the Message is a
good method to use in this case?

Though, I think it is better to publish this post to a news group like
news:microsoft.VC...
Jun 21 '07 #6

P: n/a
On Jun 21, 10:30 am, Asm23 <Asmwarr...@gmail.comwrote:
[snip]
Though, I think it is better to publish this post to
a news group like
news:microsoft.VC...
Ah Grasshopper! You have achieved wisdom.
Socks

Jun 21 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.