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.

Re: Force feedback support

Postby harbinger » Thu Sep 27, 2018 9:34 am

Is this thread still alive? I'm trying to get fg-haptics to work, but I'm struggling. I have what I think is all of the latest code, but I'm getting an error, indicating an error in the makefile. Not being a c developer, I'm not too sure how to proceed. The error is:

MAKE Version 5.41 Copyright (c) 1987, 2014 Embarcadero Technologies, Inc.
gcc -o fg-haptic ./fg-haptic.c -D_POSIX_C_SOURCE -g -O2 -Wall -std=c99 ,)) -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lm ,))
gcc.exe: error: ,)): No such file or directory

Please help! Or better still, let me know where I can download the pre-compiled binary for Windows 64-bit.

Thanks
harbinger
 
Posts: 3
Joined: Thu Sep 27, 2018 9:16 am

Re: Force feedback support

Postby wkitty42 » Thu Sep 27, 2018 11:15 am

harbinger wrote in Thu Sep 27, 2018 9:34 am:MAKE Version 5.41 Copyright (c) 1987, 2014 Embarcadero Technologies, Inc.
gcc -o fg-haptic ./fg-haptic.c -D_POSIX_C_SOURCE -g -O2 -Wall -std=c99 ,)) -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lm ,))
gcc.exe: error: ,)): No such file or directory


ummm... what are these things ,)) and where did they come from?
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 6488
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: Force feedback support

Postby harbinger » Thu Sep 27, 2018 1:28 pm

I have no idea. Well, I have a slight idea: In the makefile, there's this:

CFLAGS = -g -O2 -Wall -std=c99 $(foreach pkg,$(PKGS),$(shell pkg-config --cflags $(pkg)))
DEFS = -D_POSIX_C_SOURCE
LIBS = -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lm $(foreach pkg,$(PKGS),$(shell pkg-config --libs $(pkg)))

It looks like "$(shell pkg-config --cflags $(pkg))" and "$(shell pkg-config --libs $(pkg))" aren't returning anything, resulting in the empty list.

I'm relatively certain it's because I haven't installed the SDL developer libraries the way I should, but I have no idea where to put them or how to register them. I've tried just dumping the .lib and .dll files in the same folder as the fg-haptic source.
harbinger
 
Posts: 3
Joined: Thu Sep 27, 2018 9:16 am

Re: Force feedback support

Postby harbinger » Thu Sep 27, 2018 4:49 pm

So it turns out I was using the wrong Make.exe - I never realised that Delphi installs one as well. I've downloaded the GNUWin Make, and I'm getting further, but it's still complaining that it can't find the libs:

c:\Data\Dev\fg-haptic>"C:\Program Files (x86)\GnuWin32\bin\Make"
process_begin: CreateProcess(NULL, pkg-config --cflags sdl2, ...) failed.
process_begin: CreateProcess(NULL, pkg-config --cflags SDL2_net, ...) failed.
process_begin: CreateProcess(NULL, pkg-config --libs sdl2, ...) failed.
process_begin: CreateProcess(NULL, pkg-config --libs SDL2_net, ...) failed.
gcc -o fg-haptic fg-haptic.c -D_POSIX_C_SOURCE -g -O2 -Wall -std=c99 -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lm
fg-haptic.c:3:22: fatal error: SDL2/SDL.h: No such file or directory
#include <SDL2/SDL.h>
^
compilation terminated.
Make: *** [fg-haptic] Error 1

So how do we actually install SDL?
harbinger
 
Posts: 3
Joined: Thu Sep 27, 2018 9:16 am

Re: Force feedback support

Postby wkitty42 » Thu Sep 27, 2018 8:29 pm

i don't have a clue... i'm on linux and use the download_and_compile bash script... hopefully someone with building on winwhatever will be along soon and offer some assistance...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 6488
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: Force feedback support

Postby wlbragg » Tue Jun 25, 2019 6:28 pm

I was directed to this support application for force feedback devices after hooking up a Logitech Wingman Force usb/serial joystick. Everything checked out and appears to be on-line but I am getting inconsistent results.

I have only had the rumble test work and supply a rumble effect using the --test switch.It only works intermittently 1 out of several test attempts and usually only once if at all in any given test session. I don't think I have yet to feel the force feedback test on the stick , only rumble.
This is the terminal response during the test.

Code: Select all
root@wayne:/mnt/GDrive/fg-haptic# ./fg-haptic --test
fg-haptic version 0.5
Force feedback support for Flight Gear
Copyright 2011, 2014 Lauri Peltonen, released under GPLv2 or later

Test mode enabled.
1 Haptic devices detected.
   Device has 2 axis
   Supported effects [10 effects, 10 playing]:
      constant
      sine
      triangle
      sawtoothup
      sawtoothdown
      spring
      damper
   Supported capabilities:
      gain
      autocenter
Device 1 name is Logitech WingMan Force
Creating effects for device 1

Testing device number 1, Logitech WingMan Force.
HOLD FIRMLY TO YOUR JOYSTICK DURING THE TEST!

Press [enter] to start constant force test.

Press [enter] to start rumble test.


Test done!


Using FG and entering test mode or changing configuration in the GUI I get this error.

Code: Select all
Reading device setup from FG
Waiting for the command to go through...
Done
Creating effects for device 1
Update error: Haptic: Error updating the effect: Resource temporarily unavailable


I thought maybe it was a permission issue but no longer think that is the case. Anyone have any idea what might be going on and how to fix or even debug this?
I think this application is a good start to the whole force feedback application to FG.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5591
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Force feedback support

Postby wlbragg » Tue Jun 25, 2019 6:56 pm

Looking a bit closer at the code, the error is triggered when trying to update the device.

Code: Select all
if (SDL_HapticUpdateEffect(device->device, *effectId, effect) < 0)
      printf("Update error: %s\n", SDL_GetError());
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5591
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Force feedback support

Postby wkitty42 » Tue Jun 25, 2019 11:17 pm

maybe a timing issue?
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 6488
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: Force feedback support

Postby callahanp » Tue Jan 14, 2020 9:51 pm

I'm interested in using Force Feedback. Has anyone done any work on this since the last post in 2014?
callahanp
 
Posts: 11
Joined: Sat May 11, 2013 2:40 am
Callsign: pac1

Re: Force feedback support

Postby Zan » Fri Jan 24, 2020 8:31 pm

I recently found inspiration and time to do some updates on this force feedback thing. The latest code can be found here: https://github.com/zanppa/fg-haptic/

The main changes are:
  • Use UDP instead of TCP; this makes it possible to restart fg-haptic when flightgear is running (or just launch flightgear first, then fg-haptic). This changes the required command line to: fgfs --telnet=5401 --generic=socket,out,20,localhost,5402,udp,ff-protocol
  • fg-haptic tries to figure out the network address of flightgear from the first UDP packet, so the programs do not need to run on the same machine
  • The control surface (stick) forces are now by default modeled using a spring effect, which is a bit simpler but should have much smoother operation
  • The configuration window in fg has save & load buttons that save the configuration to disk. It's just a concept but somewhat works
  • I can also build Windows versions with mingw (both 32 and 64 bit), they are available in the bin/ directory. You need SDL2 runtime and SDL2_net runtime dlls in the same directory

I'm still thinking about how to do the configurations for different aircrafts... should they be in the aircraft data or maybe in the fg-haptic package?

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

Re: Force feedback support

Postby slawekmikula » Fri Jan 24, 2020 11:23 pm

Zan, I think it is a great work (I won't use it right now but I think there would be much fun with it :)

May I give some additional information about usability ? Right now there is a ability to create some external FG code without messing with fgdata folders (it can be troublesome for people which is only "playing" FG or without right knowledge). It's addons interface. It is described here: https://sourceforge.net/p/flightgear/fg ... ME.add-ons. Right now gui/nasal can be separated with this code into self contained package. Additionally there is work that can enable protocol inside addon (needs some work but you can track it here (https://sourceforge.net/p/flightgear/codetickets/2164/, https://sourceforge.net/p/flightgear/codetickets/2069/). When they are resolved you can encapsulate also protocol inside addon and user can install it from launcher gui.

My exemplary addons which can be looked at are here (https://github.com/slawekmikula). Another addons are here: https://sourceforge.net/p/flightgear/fg ... nk/Addons/
slawekmikula
 
Posts: 82
Joined: Sun Feb 19, 2017 9:31 am

Re: Force feedback support

Postby Zan » Sun Jan 26, 2020 4:50 pm

Hi.

Thanks for the heads up. I recently came across the FGAddon, but I understood it was missing the protocol files which are necessary for this system. When the protocol support comes to FGAddon, I will definitely package this so that that can be used.
Zan
 
Posts: 123
Joined: Tue Oct 20, 2009 10:28 am

Previous

Return to New features

Who is online

Users browsing this forum: AhrefsBot [Bot] and 0 guests