AJ13

Hello,

I am working on my engineering senior design project and need to control a force feedback joystick using software called labview. It looks like the easiest way to accomplish this is through DirectX. Labview has the ability to import .dll functions as well as .net and activex functions. If someone tell me the best way for me to accomplish this or at least point me to a specific kb to read that would be great. I've found a lot of forums about the same subject but the explanations were very vague.

I have Visual Studio 2005 as well the DirectX sdk installed if that helps.

thanks a lot!



Re: Game Technologies: DirectX 101 Need help controlling forcefeedback functions with labview

The ZMan

There are native and managed samples for force feedback in the DirectX SDK.

D:\Program Files\Microsoft DirectX SDK (February 2007)\Samples\C++\DirectInput\FFConst

D:\Program Files\Microsoft DirectX SDK (February 2007)\Samples\Managed\DirectInput\Feedback

However DirectInput is not the most straightforward API. If you are prepared to restrict yourself to just xbox controllers (the wired ones work on the PC and the wireless work if you buy the wireless adapter) then XInput is a much easier API to call as its just win32 calls and there is a managed API in XNA or wrappers here http://www.thezbuffer.com/articles/353.aspx. Xinput force feedback is not quite as sophisticated as some of the force feedback controllers out there so it depends what you want to do.






Re: Game Technologies: DirectX 101 Need help controlling forcefeedback functions with labview

AJ13

I already found those samples in the SDK and tried playing around with them, unfortunately it was beyond my programming knowledge since I am a mechanical engineering major. I need to use a logitech Force3DPro joystick specifically. We need this because the project is the blind driver project were we are converting a Cadillac SRX so that a blind person could drive. The car works autonomously but now in this stage of the project we need to use the force feedback controller to alert the blind driver if he/she is driving off course (ie into a different lane unintentionally). For example if the car is going too far to the right the joystick will guide the driver back towards the left.

I don't really need to use the eniter FFConst or Feedback programs i just need to figure out how to access their force feedback functions from a different program.





Re: Game Technologies: DirectX 101 Need help controlling forcefeedback functions with labview

The ZMan

There is no easier way of programming force feedback that I know of. I searched codeplex, codeproject and sourceforge and the only wrapper library I could find was this one

http://sourceforge.net/projects/shade-api/

The only other thing I could think of would be to find yourself a local CS major and ask them to write a .Net wrapper for DirectInput that has a simple interface that you could use. The DirectX libraries are not designed for such specific uses, inteead they give a lot of flexibility which shows in the level of complexity






Re: Game Technologies: DirectX 101 Need help controlling forcefeedback functions with labview

AJ13

can anyone tell me which header file all the directinput.dll functions are defined in i tried importing the dll's functions using the dinput.h header file but i got an error saying not all functions were defined. here's is what the output was if anyone can help:

The shared library file is invalid. The function information is obtained only by parsing the header file.

To fix, specify another valid shared library file or check Shared library file is not on the local machine checkbox. To do this, go to the Select Shared Library and Header File page.

The following header file(s) were not found in the specified header file or one of the referenced header files:
- objbase.h

To fix, add the header file to the list of include paths. To do this, select Back to go to the previous page and add the header file path to the list.

The following symbols are not defined:
CINTERFACE;UNICODE;_INC_MMDDK;_INC_MMSYSTEM;__cplusplus

Undefined symbols can prevent functions and parameters from being recognized. To correct this problem, check the header file and verify the symbols that should be added as predefined symbols. If some symbols need to be predefined, click the Back button and return to the previous page of the wizard to add the predefined symbol (for example, "NIAPI_stdcall" or "NIAPIDefined=1").
The following identifiers are not recognized as declarations.
CLSID_DirectInput; CLSID_DirectInputDevice; CLSID_DirectInput8; CLSID_DirectInputDevice8; IID_IDirectInputA; IID_IDirectInputW; IID_IDirectInput2A; IID_IDirectInput2W; IID_IDirectInput7A; IID_IDirectInput7W; IID_IDirectInput8A; IID_IDirectInput8W; IID_IDirectInputDeviceA; IID_IDirectInputDeviceW; IID_IDirectInputDevice2A; IID_IDirectInputDevice2W; IID_IDirectInputDevice7A; IID_IDirectInputDevice7W; IID_IDirectInputDevice8A; IID_IDirectInputDevice8W; IID_IDirectInputEffect; GUID_XAxis; GUID_YAxis; GUID_ZAxis; GUID_RxAxis; GUID_RyAxis; GUID_RzAxis; GUID_Slider; GUID_Button; GUID_Key; GUID_POV; GUID_Unknown; GUID_SysMouse; GUID_SysKeyboard; GUID_Joystick; GUID_SysMouseEm; GUID_SysMouseEm2; GUID_SysKeyboardEm; GUID_SysKeyboardEm2; GUID_ConstantForce; GUID_RampForce; GUID_Square; GUID_Sine; GUID_Triangle; GUID_SawtoothUp; GUID_SawtoothDown; GUID_Spring; GUID_Damper; GUID_Inertia; GUID_Friction; GUID_CustomForce; LONG; DICONSTANTFORCE; lEnd; DIRAMPFORCE; DIPERIODIC; lPositiveCoefficient; lNegativeCoefficient; lDeadBand;

For each unrecognized identifier, verify the following conditions:
1. The identifier is included in the header file(s) and declared within the predefined symbols and conditionally compiled statements (for example, "#ifdef NIAPI stdcall" or "#if NIAPIDefined").
2. If the identifier is defined as a predefined symbol or is compiled conditionally, the symbol should be added to the list of predefined symbols. You can click the Back button and return to the previous page of the wizard to add the predefined symbol (for example, "NIAPI stdcall" or "NIAPIDefined=1")

thanks a lot!