Program structure problems

A

Asm23

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.
 
V

Victor Bazarov

Asm23 said:
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.
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
 
O

osmium

Asm23 said:
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..
 
A

Asm23

<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.


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.
 
?

=?iso-8859-1?q?Kirit_S=E6lensminde?=

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
 
A

Asm23

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.





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.





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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top