Board index FlightGear Development New features

Force feedback support

Discussion and requests for new features. Please note that FlightGear developers are volunteers and may or may not be able to consider these requests.

Force feedback support

Postby Zan » Mon Dec 19, 2011 9:01 pm

Hi all.

For the last few days I have coded force feedback support for FlightGear. It currently works, I have implemented control surface loading (for jsbsim), pilot g forces and stick shaker.

Currently the system is so that I have external app which uses SDL 1.3 to handle the ff effects, so it should be portable quite easily. That program communicates with FG through telnet, and some nasal/xml magic on FG does the rest. Here's a screenshot of the configuration options (from which most do not yet work, but you get the idea):
Image

I will support: multiple devices, autocenter, control surface forces, pilot g forces and stick shaker at least. And all effects can be disabled, or disabled/enabled on some devices, and also axes should be configurable.

Now, the problem is that telnet interface is way too slow, the forces are updated once every 1 or 2 seconds, which is awfull. But I still don't know beforehand which properties to pull, so generic I/O is not good either. Does anyone have any ideas on how to solve this?

Cheers, Zan

Edit: I forgot to thank cactrot for his hapticsforfg, which gave me some ideas.
Zan
 
Posts: 123
Joined: Tue Oct 20, 2009 11:28 am

Re: Force feedback support

Postby Zan » Wed Dec 21, 2011 8:17 am

Ok yesterday I created a gitorious repository where anyone interested in this can track the project. Find it here: http://gitorious.org/fg-haptic/.

Current version now includes a Readme with instructions on building and installing it. Should be quite straightforward, though I take no responsibility if someone manages to ruin their fg installation or something :P

What has changed:
- I'm using generic IO to communicate between fg-haptic and FG, which seems to be fast enough. Currently supports 1 device, but I'm going to add at least 3 more. The interface is not so flexible, so the amount of devices will be limited unless I find another way.
- SDL interface has some tweaks to hack around bad drivers (linux drivers mostly, I guess).
- Configuration dialog does not yet properly work, you have to tweak parameters in property tree, under /haptic/.
- Supports pilot G forces and control surface loading. Stick shaker has no trigger yet.

If someone who has real world flying experience could comment on forces experienced while flying, that would be awesome. No need to test this, just tell if you can feel motor vibrations, what kind of stick shakers/stick pushers there is (like shake/push duration, strength, period), how strong is the control surface force, do you feel ground bumps when taxiing... anything that could be added as a force feedback effect.

I don't think all effects need to be 100% realistic, since you can disable them if you don't like them. But some good effects give much more from the flying experience, than just holding to a dead stick, I think.

Zan

Edit: Any GUI gurus here? Because I want to support multiple devices, I have a combo to select the device to configure. And when user changes device, all widgets change values for that devices settings. Sounds good, and it works on labels etc, but sliders keep the old position. I've tried calling dialog-update and it doesn't help. Do I need to se live=true or something on the widgets?
Zan
 
Posts: 123
Joined: Tue Oct 20, 2009 11:28 am

Re: Force feedback support

Postby hvengel » Thu Dec 22, 2011 1:41 am

There was an article published several years ago about a flight sim project at a university that was based on flightgear that they had added a force feedback system to. This project was also based on JSBSim and the article included a lot of formulas related to calculating the forces. The paper can be found here http://wpage.unina.it/agodemar/DSV-DQV/ ... _paper.pdf if you have not seen it. There are about 11 pages in this paper dealing with force feedback.

This would be a great addition to FG. Perhaps this can make it into 2.8?
hvengel
Retired
 
Posts: 1127
Joined: Sun Dec 24, 2006 5:35 am
Location: Minden Nevada

Re: Force feedback support

Postby Zan » Thu Dec 22, 2011 10:07 am

Cool! Thanks for that article, it seems to be very complete. Even though the system they developed is much more than what I'm doing.. :)

I'm sure this will make to 2.8, and most likely it can be installed as an add-on to 2.6 too. As the current version does not include any changes to flightgear's source code.

Edit: If someone has a force feedback yoke/joystick and the ability to build and test this, it would be greatly appreciated. I have few devices I can test this with, but it's still kind of limited and Linux only. Or if someone could build this on windows for me to test, that would be great too (I have a windows machine with FG, but no build software on it).
Zan
 
Posts: 123
Joined: Tue Oct 20, 2009 11:28 am

Re: Force feedback support

Postby hvengel » Fri Dec 23, 2011 7:06 pm

Zan wrote in Thu Dec 22, 2011 10:07 am:Cool! Thanks for that article, it seems to be very complete. Even though the system they developed is much more than what I'm doing.. :)


I thought that might be the case. I do software development for a living and it is very common for an initial development version of some software to have a limited feature set in part because the spec calls for that limited feature set. Then someone says something like "This is great and this may be pie in the sky but can you also make it do <insert new feature here>" and this becomes a challenge. Most developers will step up when this happens and produce surprising results. Been there and done that myself both as the person being challenged and the one issuing the challenge. That paper was me issuing one of those challenges. I really hope you take me up on it.

Also since that system was built on top of FG it is at least remotely possible that if you contacted the authors that they might be will you give you access to the source code. Worth I try at least.

Hal
hvengel
Retired
 
Posts: 1127
Joined: Sun Dec 24, 2006 5:35 am
Location: Minden Nevada

Re: Force feedback support

Postby Zan » Sat Dec 24, 2011 5:14 pm

hvengel wrote in Fri Dec 23, 2011 7:06 pm:That paper was me issuing one of those challenges. I really hope you take me up on it.

I thought about this a bit.

Because the current system supports currently up to 4 devices, and you can select which effects to send on which devices, that kind of simulator would already be possible. You would send the pilot G forces to one device, which shakes the cockpit, and another device would replicate the control surface forces (stick). I just need to make the equations correct, and it could indeed work without many more changes.

Also since that system was built on top of FG it is at least remotely possible that if you contacted the authors that they might be will you give you access to the source code. Worth I try at least.


This might be worth trying. I guess they put quite much thinking into that, it would be a waste to duplicate the effort. I'll send them email when I get the time.

Zan
Zan
 
Posts: 123
Joined: Tue Oct 20, 2009 11:28 am

Re: Force feedback support

Postby hvengel » Fri Aug 02, 2013 6:04 pm

It's been a while since this was posted and looking at the Git repository it looks like the last updates where shortly after the last post to this thread. Has activity on this been dropped?
hvengel
Retired
 
Posts: 1127
Joined: Sun Dec 24, 2006 5:35 am
Location: Minden Nevada

Re: Force feedback support

Postby Zan » Wed Mar 05, 2014 9:37 pm

Kind of dropped, but not really. I have issues with my joystick (which had only a patch to make some kind of support for force effects, and required me to rebuild the kernel by hand and after a while it did not apply properly anymore...), but after all I got around to writing my own driver, which is soon finished (working already but needs cleanup to be ready to be applied to kernel).

Anyways, after I get the joystick to work, I'm thinking of returning to FG development community. I think I should have now more time for that too, and I have some requests for things and this one is something I want to improve.

I'm still looking for someone to be able to build&test this with windows? Anyone?

Zan
Zan
 
Posts: 123
Joined: Tue Oct 20, 2009 11:28 am

Re: Force feedback support

Postby Hooray » Wed Mar 05, 2014 9:39 pm

If this works via USB/HID, we've had quite a few discussions related to this since 2011, so you may want to check back with the devel list or issue tracker here.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Force feedback support

Postby Zan » Fri Mar 07, 2014 10:05 pm

My code was a separate application using SDL, so it uses usb/hid/whatever SDL or the OS supports. It used telnet protocol to send device information to FG, which then used general protocol (telnet was not fas enough) to send the effect information back. My main goal was to not add another dependency to FG.

I'm not sure which threads you refer to, I've seen the e-mails about multiple axis joysticks and using HID events in FG, but this does not help that, since I'm using external application...
Zan
 
Posts: 123
Joined: Tue Oct 20, 2009 11:28 am

Re: Force feedback support

Postby matmat » Fri Apr 04, 2014 8:43 pm

Hi,

I'm new to FlightGear (3) and I lack Force Feedback (I have a Force 3D Pro from Logitech). Any help would be appreciated... Zan, if it can help, I should be able to compile your tool on a windows box (I may need some detailed instructions to test it).
matmat
 
Posts: 6
Joined: Fri Apr 04, 2014 8:39 pm

Re: Force feedback support

Postby f-ojac » Sat Apr 05, 2014 11:53 am

I have a GNU/Linux and a Windows (7) box, and a Sidewinder Force Feedback, I probably could test this too.
f-ojac
 
Posts: 1304
Joined: Fri Mar 07, 2008 10:50 am
Version: GIT
OS: GNU/Linux

Re: Force feedback support

Postby Zan » Sun Apr 06, 2014 6:58 pm

Cool, it would be awesome if you could test and give some feedback!

I pushed some new code today, it can be found from my gitorious repository: https://gitorious.org/fg-haptic/. It needs SDL 2.0 development libraries, others should be quite standard, and I don't think there should be anything weird in the build process. Readme has all the info on where to copy the files.

I also updated the wiki page, http://wiki.flightgear.org/Force_feedback with the latest info.

I've currently only tested (and tuned the parameters) with c172p, but any jsbsim aircraft should work. I got some ideas on IRC on how to make it work with other fdms too, I will implement them soon.

Please tell me if you encounter any problems, or have suggestions or anything.

Zan
Zan
 
Posts: 123
Joined: Tue Oct 20, 2009 11:28 am

Re: Force feedback support

Postby matmat » Tue Apr 08, 2014 1:16 pm

Hi Zan,

I tried compiling your C code on Windows using MinGW. Unfortunately it uses libraries which do not exist on Windows (ie poll.h, socket.h ...) so it cannot be compiled on Windows, your code needs to be adapted.
I have little knowledge in C but I'll try to do it anyway using Visual Studio !
matmat
 
Posts: 6
Joined: Fri Apr 04, 2014 8:39 pm

Re: Force feedback support

Postby Zan » Tue Apr 08, 2014 7:29 pm

Hi!

If you get it to work, please send the code to me so I can merge the code to make it compile on windows too. I haven't built anything on windows for years, and don't have any compiler so it's a bit difficult for me to test...

Thanks!

Zan
Zan
 
Posts: 123
Joined: Tue Oct 20, 2009 11:28 am

Next

Return to New features

Who is online

Users browsing this forum: No registered users and 8 guests