Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 19:34 Go to next message
Christopher Won is currently offline Christopher WonFriend
Messages: 11
Registered: July 2017
Junior Member
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 21:17 Go to previous messageGo to next message
Charles Rivet is currently offline Charles RivetFriend
Messages: 200
Registered: May 2014
Location: Canada
Senior Member

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


/Charles Rivet
Re: User Input [message #1769835 is a reply to message #1769833] Thu, 03 August 2017 23:03 Go to previous messageGo to next message
Christopher Won is currently offline Christopher WonFriend
Messages: 11
Registered: July 2017
Junior Member
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 12:21 Go to previous messageGo to next message
Charles Rivet is currently offline Charles RivetFriend
Messages: 200
Registered: May 2014
Location: Canada
Senior Member

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.


/Charles Rivet
Re: User Input [message #1770035 is a reply to message #1769878] Mon, 07 August 2017 16:09 Go to previous message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 353
Registered: March 2011
Senior Member
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 Sep 25 09:43:06 GMT 2018

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

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

Back to the top