Program structure problems

Discussion in 'C++' started by Asm23, Jun 18, 2007.

  1. Asm23

    Asm23 Guest

    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.
     
    Asm23, Jun 18, 2007
    #1
    1. Advertising

  2. 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
     
    Victor Bazarov, Jun 18, 2007
    #2
    1. Advertising

  3. Asm23

    osmium Guest

    "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..
     
    osmium, Jun 18, 2007
    #3
  4. Asm23

    Asm23 Guest

    On 6 18 , 9 19 , "Victor Bazarov" <> wrote:
    > 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.
     
    Asm23, Jun 19, 2007
    #4
  5. On Jun 18, 8:07 pm, 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.


    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
     
    =?iso-8859-1?q?Kirit_S=E6lensminde?=, Jun 19, 2007
    #5
  6. Asm23

    Asm23 Guest

    On 6 19 , 1 12 , Kirit Sælensminde <>
    wrote:
    > On Jun 18, 8:07 pm, 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.

    >
    > 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...
     
    Asm23, Jun 21, 2007
    #6
  7. Asm23

    Puppet_Sock Guest

    On Jun 21, 10:30 am, Asm23 <> wrote:
    [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
     
    Puppet_Sock, Jun 21, 2007
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Excluded_Middle

    Pointers to structure and array of structure.

    Excluded_Middle, Oct 24, 2004, in forum: C Programming
    Replies:
    4
    Views:
    795
    Martin Ambuhl
    Oct 26, 2004
  2. Leo Nunez
    Replies:
    3
    Views:
    1,303
    Neil Kurzman
    Feb 9, 2005
  3. Replies:
    2
    Views:
    644
  4. Replies:
    9
    Views:
    25,547
    Lal Bahadur Singh
    Nov 11, 2011
  5. John Dann

    Scope and program structure problems

    John Dann, Jul 1, 2008, in forum: Python
    Replies:
    3
    Views:
    359
    Bruno Desthuilliers
    Jul 1, 2008
Loading...

Share This Page