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 Hooray » Tue Apr 08, 2014 7:32 pm

it should work out of the box if you used SDL sockets instead of native Unix sockets: http://www.libsdl.org/projects/SDL_net/ ... C_Contents
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 matmat » Tue Apr 08, 2014 10:45 pm

Hi
So... yes I got something, but no it does not work.. so far.I had to change mainly the socket part to use WinSock and Poll to use WSAPoll instead. I reached the point where I can see my Force Feedback in the setup screen and apply the changes (sometimes), but then fg-haptic crashes (memory pb ? no error message at all). Sometimes it crashes earlier...

Source code is here http://pastebin.com/6DKt6h3r if anybody wants to review.. comments are welcome !

What I wonder is if my flightgear setup is correct for the telnet part, as the wizard forces me to set a direction and frequency. I end up with these options:

--telnet=socket,in,1,localhost,5401,tcp
--generic=socket,out,20,localhost,5402,tcp,ff-protocol

Is it OK ?
matmat
 
Posts: 6
Joined: Fri Apr 04, 2014 8:39 pm

Re: Force feedback support

Postby Hooray » Tue Apr 08, 2014 11:04 pm

see my previous posting, the code already depends on SDL, so it doesn't make sense to manually implement support for multiple socket implementation - just use SDL instead, and things will work for all OS supported by SDL.
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 f-ojac » Wed Apr 09, 2014 2:26 pm

Hi zan,
Thanks a lot for the proposal. Here's what I got for now after plugging-in my joystick in the USB port, on a GNU/Linux (Debian like)/FG Git:
Code: Select all
./fg-haptic
fg-haptic version 0.1
Force feedback support for Flight Gear
Copyright 2011 Lauri Peltonen, released under GPLv2 or later

1 Haptic devices detected.
   Supported effects [0 effects, 0 playing]:
      constant
      sine
      triangle
      sawtoothup
      sawtoothdown
      ramp
      friction
      spring
      damper
      intertia
   Supported capabilities:
      gain
Device 1 name is Microsoft SideWinder Force Fee
Creating effects for device 0
UPLOADING EFFECT ERROR: Haptic: Device has no free space left.

Aborting program execution.
quit

Does it ring you a bell? Thanks.
f-ojac
 
Posts: 1304
Joined: Fri Mar 07, 2008 10:50 am
Version: GIT
OS: GNU/Linux

Re: Force feedback support

Postby Zan » Wed Apr 09, 2014 9:53 pm

Hi all!

Hooray: Cool idea, I used some old library for fgfs communication, I will try to switch that to SDL to make it multiplatform!

matmat: I found some possible null pointers yesterday and fixed those, you could try fetching the latest code. I'll probably look at your modifications too, when I port to SDL sockets.

f-ojac: For some reason your device reports that it supports 0 effects, and thus cannot upload the effects. That is kinda strange since it supports many kind of effects... I'll try to see if there is some driver thing or does the device need other kind of effect structures or what's going on. Do you happen to know which linux driver that joystick uses?

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

Re: Force feedback support

Postby matmat » Thu Apr 10, 2014 10:30 am

Hi Zan,

Thanks, I'll have a look at your changes.

FYI even if you move to SDL_Socket, we will still need to rely on a Poll() windows equivalent.. I used WSAPoll for that, which is part of... winsock2.
So anyway we will still use the WinSock library. but it's up to you ! (or maybe someone else has a cross platform Poll replacement ?). So.. don't waste too much time on that !

Also I made a quick try with another device (Wingman RumblePad) and it did not crash but was not supported. I'll post the message later.
matmat
 
Posts: 6
Joined: Fri Apr 04, 2014 8:39 pm

Re: Force feedback support

Postby Hooray » Thu Apr 10, 2014 1:19 pm

plib/simgear should have that - and should be available to most FG users.
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 matmat » Sat Apr 12, 2014 11:27 am

Hi,

1) here is what happens with my RumblePad when I start fg-haptic:

Code: Select all
1 Haptic devices detected.
   Supported effects [128 effects, 128 playing]:
      constant
      sine
      triangle
      sawtoothup
      sawtoothdown
      ramp
      friction
      spring
      damper
      intertia
      custom
   Supported capabilities:
      gain
      status
Device 1 name is WingMan RumblePad
Creating effects for device 0
UPLOADING CONST_X EFFECT ERROR: Haptic error Unable to create effect

Aborting program execution.
fgfswrite: No error


2) I updated the code with your recent changes.I have less crashes now (still a few) but unfortunately no force feedback at all... Here is the output of fg-haptic:

Code: Select all
1 Haptic devices detected.
   Supported effects [128 effects, 128 playing]:
      constant
      sine
      triangle
      sawtoothup
      sawtoothdown
      ramp
      friction
      spring
      damper
      intertia
      custom
   Supported capabilities:
      gain
      status
Device 1 name is Logitech Force 3D Pro
Creating effects for device 0


Waiting for flightgear generic IO at port 5402, please run Flight Gear now!
Got connection, sending haptic details through telnet at port 5401
Timeout!
Timeout!
Timeout!
Timeout!
Timeout!
[lots of timeouts]
Timeout!
Timeout!
Timeout!
Timeout!
Reading device setup from FG
Waiting for the command to go through...
Done
Timeout!
Creating effects for device 0


Any clue ?
matmat
 
Posts: 6
Joined: Fri Apr 04, 2014 8:39 pm

Re: Force feedback support

Postby Zan » Sun Apr 13, 2014 12:50 pm

Hi all!

I pushed some new features. Now I transitioned to SDL_net in sockets and got ridd of the poll function, so the code should probably work for windows out of the box too... maybe?

matmat: 1) The rumblepad advertises support for all kinds of effects, when in reality it probably only supports rumble. I now changed the code so that in that situation fg-haptic no longer exits, but just doesn't use those effects.

2) I see no problem there, looks like it should work correctly. With the default settings, the force is quite subtle at low speeds. Doing some dives with tight turns usually gives good forces. Also increasing the strength in options could help.

I also added a test mode to both fg-haptic and flightgear side, so running
Code: Select all
fg-haptic --test
now plays all used/supported effects on all devices. You should try that to see if the effects work or not. Also under the "force feedback options" in flightgear is a "test" button that does similar tests (moves joystick around and rumbles it a bit). That one needs fg-haptic running normally.

At the same time I noticed there is something funny with the stick shaker implementation, I need to look into that...

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

Re: Force feedback support

Postby matmat » Thu Apr 24, 2014 5:36 pm

Hi Zan,
First of all well done with SDL sockets, your code is almost cross-platform. I just commented the signals handling part and added ssize_t definition... and it build fine.

BUT, and it's a big but, the problem is that is does not work at all. As soon as I start the force feedback test, it crashes. In fact it crashes as soon as I move the joystick or trigger a button. I start thinking that there is something wrong with SDL2 force feedback support on windows...
matmat
 
Posts: 6
Joined: Fri Apr 04, 2014 8:39 pm

Re: Force feedback support

Postby derstock » Sat May 17, 2014 10:06 pm

Hi,

first of all many thanks for the work on bringing force feedback to FlightGear.

I have successfully compiled fg-haptic on a Gentoo machine. The module seems to work and interact with the FlightGear compiled from git (last month checkout) but it does not recognize/find my devices (Logitech G940) neither in test nor in the fg config dialog.

I would appreciate any suggestions on how to debug/fix it.
derstock
 
Posts: 3
Joined: Sat May 17, 2014 9:56 pm

Re: Force feedback support

Postby derstock » Sun May 25, 2014 8:41 am

I was able to make it partially work with Logitech G940 and Gentoo. The issue was a change in the kernels hid-core report validation a way back which rendered the logitech force-feedback kernel modules virtually useless. A fix is already planned for kernel 3.15 but I ported it to my 3.14.4 and it works.

The joystick does experience FF however it seems to be somehow erratic as it moves the stick with quite some force even when the plane is on the ground in parking position (parking brakes on). The G940 provides only constant force effect for now. Any suggestions on how to debug this?
derstock
 
Posts: 3
Joined: Sat May 17, 2014 9:56 pm

Re: Force feedback support

Postby Johan G » Sun May 25, 2014 12:31 pm

A start could be to look at what properties are being used and maybe compare how the force feedback behaves with different aircraft.

A long standing issue, probably more for people with slow computers, and when using a lower FDM frequency is that in particular some YASim aircraft tend to slide while parked. That will most probably either be due to forces on the aircraft or cause forces on the aircraft, both which probably cases the force feedback to react.

EDIT: You might be helped in watching these properties by having them printed on the screen. See Property browser#Tips and tricks on the wiki.
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Some YouTube videos
Johan G
Moderator
 
Posts: 6625
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Force feedback support

Postby Parnikkapore » Thu Dec 24, 2015 4:51 am

Hi,
Thanks for all the work:)
Gitorious is now down,Pastebin still there. hapticsforfg is what I'm trying (and having fun updating it to python34),will try win build.
There are free alternatives to (almost) every program you encounter. You just have to find them.
Parnikkapore
 
Posts: 929
Joined: Thu Oct 29, 2015 11:16 am
Callsign: HS-FGS
Version: next
OS: Kubuntu

Re: Force feedback support

Postby Vik » Wed Nov 23, 2016 1:48 am

Hi there,

Sorry about raising an old thread, but I have created a fork of the fg-haptic code on Github and added a couple of small fixes. See here: https://github.com/viktorradnai/fg-haptic

If anyone on this thread has any patches I'm happy to merge them.

Cheers,
Vik
Vik
 
Posts: 12
Joined: Wed Jul 13, 2011 11:35 pm

PreviousNext

Return to New features

Who is online

Users browsing this forum: No registered users and 1 guest