Animatronic seqeuncing?-VBForums
Results 1 to 3 of 3

Thread: Animatronic seqeuncing?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2018
    Posts
    2

    Question Animatronic seqeuncing?

    Hello everyone! As you can probably tell by my username, I generally work with animatronics and their control systems, as a hobby. Right now, I am developing a software that interfaces with a serial device which interprets serial messages into animatronic movements. Essentially, what happens is the home-row keys on the keyboard (a s d f j k l ;) can each be mapped to one of many serial signals on the serial device. At the same time, a VLC media player plugin plays an audio file. There is also a timer that starts at the same time as the audio in order to keep time. When each keyboard button is pressed, the current elapsed milliseconds are recorded in a list box, and upon release, the same thing occurs in a separate list box. This is where I am running into issues; I cannot playback the sequences. I am unsure how to get the code to constantly compare the current elapsed milliseconds with the currently selected list box item. Does anyone have a suggestion on how I can achieve this? Note: the sequence playback needs to occur both during "playback mode" and "record mode" in order the visualize the full sequence that is being done, since sequencing is usually done is several passes. If list boxes aren't the way to go, that would be ok. They were just my initial idea. Note that the sequences eventually need to be saved and opened somehow. By the way, I am using VB 2010 Express.

    Thanks for reading.

  2. #2
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    4,179

    Re: Animatronic seqeuncing?

    From your description, I'm not quite clear on the sequencing.
    What I imagine from your description is something along these lines.
    You start the scenario in some manner.
    When you start the scenario, an audio file is started and a timer is started.
    Then you press keys one at a time manually in time with your audio to start a motion and later release the key to stop the motion.
    Perhaps you may want to allow pressing more than one key at a time, but as long as the keyboard supports it, that shouldn't be an issue.

    What you need to record is the key pressed (what motion is active) and what time it starts, and what time it stops.

    After recording one pass, lets call it a layer, you can start the process again, with the recorded motions being played back in time with the audio, while also recording additional motion commands, another layer, resulting in a combination of motions.
    You can repeat the process a number of times, combining layers, until you have a complete performance.
    You want to save the completed performance and reload and play it back at a later time.

    I'm wondering if you send a serial message when a particular key is first pressed down, and then a related serial message when that key is released.
    If so, then I would treat those as two separate events to be recorded in a list that identify those events.
    The event definition itself would be a class to hold the event type (key), the time of the event, and the event state (on or off).
    I would have two lists of that class type.
    One list would be the previous pass, and the other would be the current pass.

    When you're recording, you would first read an event from the previous pass list to see what time it should happen.
    If the user presses a key or releases a key, you add the appropriate time tagged event to the current pass list.
    All the while you're monitoring the time and if the event read from the previous pass list should happen, you do it and add the event to the current pass list, and read the next event from the previous pass list and keep monitor the time for it.

    Once you're done with a recording pass, clear the previous list, and copy the current list to it, then clear the current list to be ready for the next pass.
    Once you're done with the whole scenario, you can save the completed list (the previous list) to a file.

    I believe that is the basic way I would do it. I don't have time to go into details now, and you'll need to confirm if what I've describe above seems to fit with what your needs are. If so, then someone may jump in and start filling in some options about how you might go about the actual mechanics of the process.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2018
    Posts
    2

    Re: Animatronic seqeuncing?

    Quote Originally Posted by passel View Post
    From your description, I'm not quite clear on the sequencing.
    What I imagine from your description is something along these lines.
    You start the scenario in some manner.
    When you start the scenario, an audio file is started and a timer is started.
    Then you press keys one at a time manually in time with your audio to start a motion and later release the key to stop the motion.
    Perhaps you may want to allow pressing more than one key at a time, but as long as the keyboard supports it, that shouldn't be an issue.

    What you need to record is the key pressed (what motion is active) and what time it starts, and what time it stops.

    After recording one pass, lets call it a layer, you can start the process again, with the recorded motions being played back in time with the audio, while also recording additional motion commands, another layer, resulting in a combination of motions.
    You can repeat the process a number of times, combining layers, until you have a complete performance.
    You want to save the completed performance and reload and play it back at a later time.

    I'm wondering if you send a serial message when a particular key is first pressed down, and then a related serial message when that key is released.
    If so, then I would treat those as two separate events to be recorded in a list that identify those events.
    The event definition itself would be a class to hold the event type (key), the time of the event, and the event state (on or off).
    I would have two lists of that class type.
    One list would be the previous pass, and the other would be the current pass.

    When you're recording, you would first read an event from the previous pass list to see what time it should happen.
    If the user presses a key or releases a key, you add the appropriate time tagged event to the current pass list.
    All the while you're monitoring the time and if the event read from the previous pass list should happen, you do it and add the event to the current pass list, and read the next event from the previous pass list and keep monitor the time for it.

    Once you're done with a recording pass, clear the previous list, and copy the current list to it, then clear the current list to be ready for the next pass.
    Once you're done with the whole scenario, you can save the completed list (the previous list) to a file.

    I believe that is the basic way I would do it. I don't have time to go into details now, and you'll need to confirm if what I've describe above seems to fit with what your needs are. If so, then someone may jump in and start filling in some options about how you might go about the actual mechanics of the process.
    Yes, I believe everything there is correct. The keyboard press and release are already separated and there are separate on and off serial signals for each movement.

    I think what you stated is pretty much want I want to achieve, but the actual method to do it isn't exactly clear in my mind. I must admit that I am not too experienced in Visual Basic programming. Most of my coding experience is with Arduino, which clearly works very differently than VB, but my only software coding experience is in VB. With Arduino, constantly comparing values is the simplest thing ever, so it could partially be that my mind is too accustomed to that language .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width