Skip to main content



      Home
Home » Eclipse Projects » Papyrus for Real Time » User Input(Ways of getting user input that doesn't require constant listening)
User Input [message #1769828] Thu, 03 August 2017 15:34 Go to next message
Eclipse UserFriend
I'm trying to think of a way of getting user input that doesn't require the program to be constantly listening for key presses as this holds up the rest of the events happening

An example of the problem I am currently having is that I have a timer which controls the movement of an automated zombie (it just moves until it reaches a wall, turns around and moves the other direction repeating this). In another capsule I have a state that uses fgetc to get user input on how to control the player character. This however raises the problem in which fgetc waits for user input and so while its waiting for user input, the automated zombie can't move, once an input is read by fgetc, the automated zombie moves one step and then it produces errors as the state diagram is not ready for another timeout

I currently can't think of any way around this problem as getting user input requires the program to be listening for key presses or a specific key press

Any help would be greatly appreciated
Re: User Input [message #1769833 is a reply to message #1769828] Thu, 03 August 2017 17:17 Go to previous messageGo to next message
Eclipse UserFriend
The easiest way wold be to have the "UI" listening for key presses on a separate thread from the rest of the application.

Check out the Thread Assigment topic in the Papyrus-RT wiki to see how you can assign different parts of your model to different threads.

In more industrial contexts, the User interface would be in a separate executable and it would connect through some commincation chanel (IPC, named pipes, CORBA, etc.)
Re: User Input [message #1769835 is a reply to message #1769833] Thu, 03 August 2017 19:03 Go to previous messageGo to next message
Eclipse UserFriend
Does Top.Controllers go in the same folder as where the executable is generated and where the .cc, .hh and .o files are

Thanks
Re: User Input [message #1769878 is a reply to message #1769835] Fri, 04 August 2017 08:21 Go to previous messageGo to next message
Eclipse UserFriend
Yes, it does go in the same location as the executable.

I have updated the the Thread Assigment topic in the Papyrus-RT wiki to make this clearer.
Re: User Input [message #1770035 is a reply to message #1769878] Mon, 07 August 2017 12:09 Go to previous message
Eclipse UserFriend
Sorry, I have to correct Charles. You should put the "Top.controllers" file in the same folder as the model, not the generated C++.
Previous Topic:Incrementing time
Next Topic:Protocol with pointers and arrays
Goto Forum:
  


Current Time: Tue May 20 03:21:04 EDT 2025

Powered by FUDForum. Page generated in 0.03161 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top