1. Do not share user accounts! Any account that is shared by another person will be blocked and closed. This means: we will close not only the account that is shared, but also the main account of the user who uses another person's account. We have the ability to detect account sharing, so please do not try to cheat the system. This action will take place on 04/18/2023. Read all forum rules.
    Dismiss Notice
  2. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  3. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  4. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

How to handle endless rotation?

Discussion in 'Miscellaneous' started by JBoogie, Jan 21, 2014.

  1. JBoogie

    JBoogie Member

    Joined:
    Jan 14, 2014
    Messages:
    82
    Occupation:
    Pre-sales Engineer
    Location:
    Northern VA
    Balance:
    1,524Coins
    Ratings:
    +37 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, SimforceGT
    I have been playing with the simtools output and arduino and came across an interesting issue. I'm sure it has been solved in many ways and I'm curious what the sim should do. In a flight sim, if the plane does a complete 360 degree roll, what should the sim do?

    For my testing with arduino, I have adapted racingMatt's controller code and replaced the motor output PID code with my own which simply maps the Axis output to a range of 0-180 so I can control simple hobby servos.

    When I do a roll in FSX, the servo moves to its limit, then jumps back to the complete opposite limit and continues moving in the original direction. It makes perfect sense why it is doing this, but it makes me wonder what the sim should do in this case?

    Thanks!
  2. RaceRay

    RaceRay Administrator Staff Member SimAxe Beta Tester

    Joined:
    Nov 8, 2006
    Messages:
    4,656
    Occupation:
    Self-employed | Web and application development
    Location:
    Hamburg, Germany
    Balance:
    23,862Coins
    Ratings:
    +1,999 / 13 / -0
    My Motion Simulator:
    2DOF, DC motor, SimAxe, SimforceGT
    The sim should move to the same direction like the virtual plane until his mechanical or electronically limited endpoints are reached. It should stay in this position until the rotating of the virtual plane is done, it should stay in this position even when the movement of the plane has not been completed to that timepoint. If the sim moves fast back and than forward to continue simulating the rotating of the plane you get an unnatural feeling of motion because the screen is showing a completely different movement.
    This is a good example why people gets motion sick in not well tuned motion simulator.

    For mechanics which large freedom of movement another idea is to use a washout effect, rotate very slowly the simulator back when endpoints are reached and than change the direction of movement again to simulate rotating. Imho not recommend for simulators which small freedom of movements.
    • Agree Agree x 1
    • Informative Informative x 1
  3. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,431Coins
    Ratings:
    +1,684 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    BTW we have a Arduino code onsite for using servos in a model example. but cool ya done ya own.
  4. JBoogie

    JBoogie Member

    Joined:
    Jan 14, 2014
    Messages:
    82
    Occupation:
    Pre-sales Engineer
    Location:
    Northern VA
    Balance:
    1,524Coins
    Ratings:
    +37 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, SimforceGT
    Thanks eaorobbie, I actually started with the code from RacingMatt's controller and just replaced the motor control and feedback with simple servo control using the arduino servo library. I have fun writing code too, plus it helps me better understand what is really going on!

    I would be very interested to see the code you are referring to. I grabbed RacingMatt's from the downloads section. Is there someplace else I should be looking?

    thanks!
    JB
  5. JBoogie

    JBoogie Member

    Joined:
    Jan 14, 2014
    Messages:
    82
    Occupation:
    Pre-sales Engineer
    Location:
    Northern VA
    Balance:
    1,524Coins
    Ratings:
    +37 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, SimforceGT
    What is the easiest way to visualize the output data from the game engine? The reason I ask is I am really interested to see what the actual axis output looks like when a roll like this is executed. I have a pretty good idea based on how my servo is reacting, but actually seeing the values would be helpful.

    When connected to an arduino with the USB, I can't use the serial port to print log messages like I normally would for something like this. (That made testing/debugging a royal pain btw!) What I am wondering is if there is some little .Net program someone has written which can simply display the Axis data output from the Game Engine? Is there anything like that floating around? - or any other ideas?
  6. Historiker

    Historiker Dramamine Adict Gold Contributor

    Joined:
    Dec 16, 2010
    Messages:
    2,160
    Occupation:
    Retired
    Location:
    Michigan USA
    Balance:
    9,195Coins
    Ratings:
    +2,161 / 19 / -1
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform, 6DOF
    Doesn't RufusDufus' SMC utility do that?
  7. JBoogie

    JBoogie Member

    Joined:
    Jan 14, 2014
    Messages:
    82
    Occupation:
    Pre-sales Engineer
    Location:
    Northern VA
    Balance:
    1,524Coins
    Ratings:
    +37 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, SimforceGT
    Ok so I wrote my own little utility to output the GameEngine data and it looks exactly as I thought it would. Which leaves me with some follow up questions of course! :)

    The output I see from the GameEngine for the roll axis (in 8 bit decimal) is something like this:
    127 <- this is the starting point, wings level, basically no movement as expected.
    129
    131
    135 <- I have started my roll so again, as expected we see this figure go up
    137
    ... <- continuing the roll so this continues to go up.
    245
    13 <- here is where I have a question. Based on my testing this is what I suspected was being output by the GameEngine but my question is whether this is correct.
    15
    16

    Maybe I just have false assumptions and am not understanding the way these things work yet, but I was expecting that as long as I am continuously rolling, the output should continue build until it reaches the higher value (in this case 255) and then stayed pegged there until I stop rolling. So I guess my question is this: which component is responsible for this kind of logic? FSX physics engine? The simtools plugin, the game engine itself? Or should the PID controller manage this?

    I hope the question makes sense. As I'm typing it I feel like I am not explaining it very well!

    Thanks guys, I am really just trying to wrap my head around all this stuff. I am a curious person and it drives me nuts to just blindly accept something as fact!

    Thanks!
    -JB
    • Like Like x 1
  8. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    5,282
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    49,207Coins
    Ratings:
    +5,093 / 18 / -0
    Your controller does this @JBoogie .

    In simple terms...
    Your game feeds telemetry data to SimTools.
    Simtools takes the data from the game and breaks it into commands that can be sent to a motion controller.
    Your motion controller receives the commands and moves the motor to the needed point.

    Most motion controllers don't have pot rollover. you simply gear the pot to the distance you want your motor arm to move.
    So in a 8 bit setup - 127 in the middle location and 0 is all the way in one direction while 255 is all the way in the other.
    Does that help?
    yobuddy
  9. JBoogie

    JBoogie Member

    Joined:
    Jan 14, 2014
    Messages:
    82
    Occupation:
    Pre-sales Engineer
    Location:
    Northern VA
    Balance:
    1,524Coins
    Ratings:
    +37 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, SimforceGT
    Thanks yobuddy, I think I have been thinking too much on this. :) I assumed that the "physics engine" from the game was outputting the inertial forces, meaning when I make a sharp roll to the left, my body is actually feeling like it is being pushed to the right! Now that I think about it though, I guess the telemetry data outputted from the game is the actual orientation of the plane?

    If this is the case, my controller then is what would need to have the logic which translates the telemetry data into the correct motor movement to create the correct motion cues? This is the piece I am still not grasping I think. Where exactly do we define this kind of logic?
  10. value1

    value1 Nerd SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Jan 9, 2011
    Messages:
    2,184
    Location:
    Zug, Switzerland
    Balance:
    14,751Coins
    Ratings:
    +3,322 / 11 / -1
    My Motion Simulator:
    2DOF, DC motor, JRK, Joyrider
    The telemetry data we typically extract from a game is the orientation angles (pitch, roll, yaw) and the surge, sway and heave acceleration.
  11. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    5,282
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    49,207Coins
    Ratings:
    +5,093 / 18 / -0
    All game publishers output telemetry different if at all.

    SimTools does this - it collects the motion cues from the game and creates output that is compatible with a given controller.

    btw - about the complete 360 degree roll issue.
    This output depends on the plugin.
    I have created a plugin before so that when the plane gets to 90deg it starts moving back toward the center (so a 91deg becomes a 89deg), same goes for over 270.
    The end result is a smooth transition on a barrel roll.
    It's just the matter of a custom plugin is all.
    yobuddy
    • Like Like x 1
    • Winner Winner x 1
  12. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,431Coins
    Ratings:
    +1,684 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    Thats a top idea mate this proberly should be set for flight plugins as a Standard.
    Would make flight stuff feel a lot more realistic.
  13. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    5,282
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    49,207Coins
    Ratings:
    +5,093 / 18 / -0
    Yes, unless the simulator actually can go upside down, then I think this makes sense for at lest Pitch and Roll to do as described in the post above.
    Not sure about the rest of the DOF's thou.
    yobuddy
  14. JBoogie

    JBoogie Member

    Joined:
    Jan 14, 2014
    Messages:
    82
    Occupation:
    Pre-sales Engineer
    Location:
    Northern VA
    Balance:
    1,524Coins
    Ratings:
    +37 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, SimforceGT
    Ahh, OK. Starting to become a bit more clear in my head now! Thanks guys!
  15. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,145
    Location:
    Oklahoma City, USA
    Balance:
    16,614Coins
    Ratings:
    +1,835 / 32 / -1
    There are two methods I know of to implement motion with flight. Use the actual orientation of the aircraft or use pitch, roll, and heave (or more) acceleration values when available. When using acceleration values there is no need for a plugin. However orientation values are usually available or more easily found while acceleration values are not (from what I have experienced anyway). The orientation method without a plugin is fine for use with commercial type aircraft where one is not expected to make a roll or pitch over. However for military type fighters or aerobatic aircraft the acceleration method is more desired. While I don’t have actual experience flying, it is my belief that pilots of such aircraft can’t always easily determine their orientation anyway unless the ground is visible. To implement the orientation method with this type of aircraft a plugin is required that will hold the simulator in its current maximum position in a roll or pitch over condition until the aircraft starts coming out of the condition at which point the simulator should start returning to center. Therefore, if you are in a continuous roll of several rotations for example, your simulator should not change from its maximum roll position at all until it begins to come out of the roll. It should be possible to make a plugin that calculates the rate of change for both pitch and roll and use that information to determine if the accelerations are increasing, decreasing, or constant when it is not already available in the telemetry data. I wrote my own motion software for flight before finding this site and have already used this method and it works. However I have one issue in that if the input values don’t arrive at perfectly consistent time intervals, the calculated acceleration values will fluctuate somewhat and that is not desirable. I moved on to other things (racing) before finding a perfect working solution for this and have not yet returned to it (tried averaging values and time difference allowances but did not achieve what was desired before focusing on racing).
    • Informative Informative x 2
  16. JBoogie

    JBoogie Member

    Joined:
    Jan 14, 2014
    Messages:
    82
    Occupation:
    Pre-sales Engineer
    Location:
    Northern VA
    Balance:
    1,524Coins
    Ratings:
    +37 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, SimforceGT
    Thanks @BlazinH that helps explain a lot of what I was trying to figure out. I may have to start looking into plugin development so I can play around with this...although like you, I am already starting to look at racing too so we'll see how that pans out! :)

    BTW - I'm originally from OKC (grew up in Surrey Hills, went to Yukon schools).
  17. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,145
    Location:
    Oklahoma City, USA
    Balance:
    16,614Coins
    Ratings:
    +1,835 / 32 / -1
    Hi @JBoogie , It would be nice to have another simulator lover close by so I wish you were still around. I should say that those methods were how I was trying to do it. The usual way is with a washout I suppose but I didn’t like the way it felt on my rig because you really don’t want to feel it. In reality when you suddenly stop a roll condition, you don’t feel a movement back in the opposite direction, it just stops where it is at. So really it’s a matter of choice which way you prefer and depending on your setup.
  18. JBoogie

    JBoogie Member

    Joined:
    Jan 14, 2014
    Messages:
    82
    Occupation:
    Pre-sales Engineer
    Location:
    Northern VA
    Balance:
    1,524Coins
    Ratings:
    +37 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, SimforceGT
    Next time I get back, I'll be sure to look you up! I would really love to be able to try a few different sims before building my own! I'm still trying to decide what to build!

    Back on topic...so "washout" would be where the roll initiates one way and then after the initial motion cue, it slowly goes back to center?
  19. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,145
    Location:
    Oklahoma City, USA
    Balance:
    16,614Coins
    Ratings:
    +1,835 / 32 / -1
    Yes, that’s exactly what a washout is. Usually kicks in after the initial motion cue ceases to increase. To elaborate some, when using acceleration values only (g forces) an axis will start returning to center proportionally to deceleration. Almost mirrors the joystick motion if that’s what you are using for flight (assuming you have enough forward speed). Acceleration values are what racing simulators usually use although actual pitch and roll can also be added in to simulate going up a hill for example. But I feel this is confusing to the brain sometimes when different values share the same axis because it doesn’t always know what’s for what. Back to flight. Another thing I wanted to do but didn’t fully accomplish was a washout after completing a full roll for example using the orientation values. The platform holds it’s maximum position like I and RaceRay stated until the condition is ending at which point the washout kicks in to bring the platform back to center. This should work pretty well especially when there is enough time for it to center before a new action is called. But it is difficult to implement because of the way the values are changed after a roll or pitch over. The method yobuddy speaks of is probably the easiest to implement to get the values and position back in sync after a roll or pitch over but is not ideal imo. When doing a multiple turn roll the platform would be doing a teeter-toter action. Also ideally a washout is slow enough that you can’t feel it (but that of course also means it takes more time to complete). However, visual miscues must also be eliminated or you will still see it. This means that you want to block out any movement you can see other than you monitor and your rig if possible.
    Since your stated occupation is a software engineer may I ask what language(s) you use? If you do arduino I assume at least one is C++. In any case you can probably write your own program to do what you desire so there is no need for a plugin (unless maybe you want to do one for the community). Simtools has a NET output method so all that is required of your program is to import the values required. Then you can do what you wish with them and export them to your motion controller yourself. This is what I do, well kind of. Since I already had motion software written for flight, I just made some minor modifications to use it with racing. So I just import the raw data I want and manipulate and mix it to my desire before sending it out directly to a sabertooth motor controller using serial output. No motion controller like an 8bit arduino in between is needed so I use 16bit data. I do use a picaxe though to read and export 12bit encoder values to my program.
    Btw Let me know next time your in the area and maybe we can work something out. I live on the opposite side of OKC by Tinker Air Force Base however. But it’s less than a half hour drive on the new I-40 cross-town. And go OKC Thunder!! I don’t know how long you have been gone but were finally getting some national attention around here other than stuff like the bombing etc.!
  20. JBoogie

    JBoogie Member

    Joined:
    Jan 14, 2014
    Messages:
    82
    Occupation:
    Pre-sales Engineer
    Location:
    Northern VA
    Balance:
    1,524Coins
    Ratings:
    +37 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, SimforceGT
    I moved to the DC area right after I graduated from OU in '98, so its been a while! I don't really follow basketball but my little bro lives in Norman and was always a baller so he keeps me up to speed on the Thunder. Its nice to finally have a real pro team in town, but to this day, OU football is still the biggest thing for me!

    Anyway, back to the thread, I was never a hard core developer but I'm proficient in the easy languages like perl, PHP, javascript (JQuery) - all C based syntax so I naturally feel very comfortable with arduino. More recently I have been developing iOS apps as well - now that was a learning curve! Anyway, yeah I could either customize the code in arduino or maybe would even be better to write it in perl so the PC can do the processing, then pass that on to the arduino to drive the motors. In any case, thats way down the road...I'm still really just trying to figure everything out - of course I need to design and build a sim now too!