Libfreespace 0.7 is now released!

175 views
Skip to first unread message

Merrill

unread,
Oct 10, 2013, 11:23:02 AM10/10/13
to libfre...@googlegroups.com
The latest version of libfreespace and libfreespace-examples is now available for download.  This version adds support for the new FSM-9 module from Hillcrest Labs which offers full 9-axis fusion with dynamic magnetometer calibration which provides a highly stable and long-term accurate orientation output.  Also the FSM-9 enables user configurable sample rates (up to 250 Hz for full calibrated fusion), the AR/VR smoothing feature, and some new power management and activity classification options.  To download this software, visit the download page at the libfreespace site.  Libfreespace 0.7 supports the FSM-9, the FSM-6, the FSM-USB-2, and the Scoop.  For legacy devices such as the FSRK-2.4G-1 and the FSM-USB-1 you should continue to use libfreespace 0.6 or earlier.

For more information about the FSM-9, visit Hillcrest's FSM-9 product page.

For details about utilizing these new features in libfreespace and migrating your libfreespace 0.6 software to 0.7 (there are a few small API changes), see the migration guide.  Please post any questions or issues to this forum.

Thanks,
-Merrill
libfreespace moderator

info...@gmail.com

unread,
Jul 28, 2014, 6:16:31 AM7/28/14
to libfre...@googlegroups.com
Hi dear Merrill
i have used VS 2010 and libfreespace-examples to communicate with FSM9.there are several Errors that commented in the main cpp according the lines below :
// LFS_fiemware07_01.cpp : Defines the entry point for the console application.
//

//#include "stdafx.h"
/**
 * This file is part of libfreespace-examples.
 *
 * Copyright (c) 2009-2013, Hillcrest Laboratories, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in
 *       the documentation and/or other materials provided with the
 *       distribution.
 *     * Neither the name of the Hillcrest Laboratories, Inc. nor the names
 *       of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written
 *       permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
//#ifdef WIN32
//#include "stdafx.h"
//#include <windows.h>
//#else
//#include <stdlib.h>
//#include <unistd.h>
//#endif
#include "stdafx.h"
#include <windows.h>

#include <stdio.h>
#include <freespace/freespace.h>
#include <freespace/freespace_printers.h>
#include "freespace/appControlHandler.h"

#include <string.h>

#define BUFFER_LENGTH 1024

// Cross platform sleep macro
#ifdef _WIN32
#define SLEEP    Sleep(100)
#else
#define SLEEP    sleep(1)
#endif

/**
 * Callback that handles product ID response messages received from devices
 * @param id the device the message is from
 * @param message a pointer to the message to send
 * @param cookie not used in this example
 * @param result FREESPACE_SUCCESS if a packet was received; else error code
 */
static void receiveMessageCallback(FreespaceDeviceId id,
                                   struct freespace_message* message,
                                   void* cookie,
                                   int result) {
                                       
    struct freespace_ProductIDResponse* pr = &(message->productIDResponse);
    
    if (result == FREESPACE_SUCCESS && message != NULL) {
        if (message->messageType == FREESPACE_MESSAGE_PRODUCTIDRESPONSE) {
            printf("Received product ID response message from device ID: %d\n", id);
            if (pr->deviceClass == 1) {
                printf("    Device class:   dongle\n");
            } else if (pr->deviceClass == 2) {
                printf("    Device class:   handheld\n");
            } else {
                printf("    Device class:   unknown\n");
            }
            printf("    Part Number:    %d\n", pr->swPartNumber);
            printf("    Build Number:   %d\n", pr->swBuildNumber);
            printf("    Serial Number:  %d\n", pr->serialNumber);
            printf("    Version Number: %d.%d.%d\n", pr->swVersionMajor, pr->swVersionMinor , pr->swVersionPatch);
        }
    } else if (result == FREESPACE_ERROR_NO_DATA) {
        printf("Message with no data received from device ID %d.\n", id);
    } else {
        printf("Problem with message received from device ID %d.\n", id);
    }
}


/**
 * Callback that 
 *  - displays the devices that have been inserted into and removed from the system.
 *  - requests the firmware version of any devices that have been inserted into the system.
 * Implements freespace_hotplugCallback
 * @param event The type of event.
 * @param id The affected device.
 * @param cookie Not used for this application.
 */
void hotplugCallback(enum freespace_hotplugEvent event,
                     FreespaceDeviceId id,
                     void* cookie) {
    int rc=0;
    struct freespace_message message;

    switch (event) {

        case FREESPACE_HOTPLUG_INSERTION:
            // Get and print USB HID information about the device.
            printf("Device Inserted: %d\n", id);
            // --------------> error #1
//rc = printDeviceInfo(id);
            if (rc != FREESPACE_SUCCESS) {
                printf("Could not display device info: %d\n", rc);
                return;
            }

            // Open the device to be able to communicate with it
            // --------------> error #2
//rc = freespace_openDevice(id);
            if (rc != FREESPACE_SUCCESS) {
                printf("Error opening device.\n");
                return;
            }

            // Set the handler that handles messages received from the device.
            // --------------> error #3
//freespace_setReceiveMessageCallback(id, receiveMessageCallback, NULL);

            // Create and send a product ID request message to the device
            memset(&message, 0, sizeof(message)); // Start with a clean message struct
            message.messageType = FREESPACE_MESSAGE_PRODUCTIDREQUEST;
            // Allow message.dest to have the default value of 0. This will cause the message
            // to go to the remote or the module
            
       // --------------> error #4
//rc = freespace_sendMessageAsync(id, &message, 100, NULL, 0);
            if (rc != FREESPACE_SUCCESS) {
                printf("Error sending productID request\n");
                return;
            }
            // To communicate with a dongle set the dest field to 1
            message.dest = 1;
                    // --------------> error #5
//rc = freespace_sendMessageAsync(id, &message, 100, NULL, 0);
            if (rc != FREESPACE_SUCCESS) {
                printf("Error sending productID request\n");
                return;
            }

            break;

        case FREESPACE_HOTPLUG_REMOVAL:
            printf("Device Removed: %d\n", id);
            break;

        default:
            printf("Unrecognized freespace_hotplugEvent.\n");
            break;
    }
}

/**
 * main
 * This example uses the asynchronous API to
 *  - detect removal or additon of devices
 *  - get the product ID information from added devices
 * Devices may or may not be connected when this example is launched
 * Devices may be add/removed (pugged/unplugged) while this example is running.
 */

int _tmain(int argc, _TCHAR* argv[])
{
    int numIds;
    int deviceIds[FREESPACE_MAXIMUM_DEVICE_COUNT];
    int rc=0;
    
    // Flag to indicate that the application should quit
    // Set by the control signal handler
    int quit = 0;
            // --------------> error #6
//printVersionInfo(argv[0]);
// --------------> error #7
    //addControlHandler(&quit);

    // Initialize the freespace library
    // --------------> error #8
//rc = freespace_init();
    if (rc != FREESPACE_SUCCESS) {
        printf("Initialization error. rc=%d\n", rc);
        return 1;
    }

    // Set the callback to catch the initial devices.
    printf("Detecting the Freespace devices already connected...\n");
    // --------------> error #9
//freespace_setDeviceHotplugCallback(hotplugCallback, NULL);
       // --------------> error #10
//freespace_perform();

    printf("Waiting for Freespace devices to be inserted...\n");
    printf("Type Ctrl-C to exit\n");
    while (!quit) {
        // Easy event loop - just poll freespace_perform periodically
        // rather than waiting on select or WaitForMultipleObjects
        SLEEP;

        // Callbacks are called from within the perform call.

       // --------------> error #11
//freespace_perform();
    }

    printf("Exiting\n");
    printf("Cleaning up all devices...\n");
    // --------------> error #12
//rc = freespace_getDeviceList(deviceIds, FREESPACE_MAXIMUM_DEVICE_COUNT, &numIds);
    if (rc == FREESPACE_SUCCESS) {
        int i;
        for (i = 0; i < numIds; i++) {
            // --------------> error #13
//freespace_closeDevice(deviceIds[i]);
        }
    } else {
        printf("Error getting device list.\n");
    }

    // --------------> error #14
//freespace_exit();
return 0;
}
 would u plz help me to solve the Errors?

BR
Infokade

Merrill

unread,
Jul 28, 2014, 9:39:39 AM7/28/14
to libfre...@googlegroups.com
Hello Infokade,

Sorry you are having trouble with the libfreespace-examples.  Can you answer a few questions for me?

- Do the libfreespace-examples work for you without modification?
- I do not understand what errors you are receiving based on the information you provided in your recent email.  Please provide build logs and further details about what you are trying to do, and what errors you are receiving.

Thanks,
-Merrill

info...@gmail.com

unread,
Aug 11, 2014, 3:48:17 PM8/11/14
to libfre...@googlegroups.com
Hi Merrill
i can  run libfreespace-examples 0.6 but can not run libfreespace-examples 0,7 .. there is no solution in libfreespace-examples0,7 and its complecateted .
according ur post FSM 9 doesnt work with libfreespace-examples0.6 and i cant use libfreespace-examples 0.7 . plz help me to solve my problem

BR
INFOKADE  

Merrill

unread,
Aug 11, 2014, 4:26:20 PM8/11/14
to libfre...@googlegroups.com
Hello Infokade,

I have created a detailed list of instructions for how to build Libfreespace-examples 0.7 on Windows using Visual Studio 2010.  Please follow these instructions precisely and let me know if you have any issues.  If you do have issues, please provide me the specific error that you are receiving:

How to Build Libfreespace-Examples 0.7 with Visual Studio 2010

1.  Download libfreespace source
2.  Download libfreespace-examples source
3.  Download and install cmake
4.  Download and install the WinDDK v7.1.0
5.  Extract the zip files to your working directory (example:  C:\work\)
              So you would have:
                          C:\work\libfreespace-0.7\

                              and

                          C:\work\libfreespace-examples-0.7\

6.  Rename the directories to remove the version numbers:
              So you would have:
                          C:\work\libfreespace\

                               and
                           C:\work\libfreespace-examples\
7.  Open cmake-gui
8.  Under "Where is the source code", choose the directory location where your libfreespace-examples source is (e.g. C:\work\libfreespace-examples\)
9.  Under "Where to build the binaries", choose a directory where you want the solutions created (e.g. C:\work\builds\)
10. Click Configure
11. When prompted to specify the generator, choose Visual Studio 2010 and "Use Default Native Compilers"
12. Confirm the following cmake variable:
       WINDDK_DIR    -   If you installed the WinDDK in the default directory then this should be fine, if it was installed somewhere else choose that directory here
13. Click Configure again
14. The Red bars should now be gone.  Now click Generate
15. There should be a Visual Studio project under the "Where to build the binaries location".  The project will be called libfreespace-examples.sln.  Open this in Visual Studio 2010
16.  Click F7 to build all.  There should now be a group of executables in the Debug folder

info...@gmail.com

unread,
Aug 12, 2014, 7:30:50 AM8/12/14
to libfre...@googlegroups.com
Hello Merrill
thank u very much for ur Complete Answer. It was so use full.
I did every things u said. but I have two Errors :
Error    1    error MSB6006: "cmd.exe" exited with code 9009.    E:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets    151

Error    2    error LNK1104: cannot open file 'libfreespace\Debug\freespace-codecs.lib'    F:\Work\Build\LINK

So what can i do to solve these Errors?

BR
Infokade

info...@gmail.com

unread,
Aug 17, 2014, 1:41:02 AM8/17/14
to libfre...@googlegroups.com
Hello Merrill
thank u very much for ur Complete Answer. It was so use full.
I did every things u said. but I have two Errors :
Error    1    error MSB6006: "cmd.exe" exited with code 9009.    E:\Program Files (x86)\MSBuild\Microsoft.Cpp\
v4.0\Microsoft.CppCommon.targets    151

Error    2    error LNK1104: cannot open file 'libfreespace\Debug\freespace-codecs.lib'    F:\Work\Build\LINK

So what can i do to solve these Errors?

BR
Infokade


On Thursday, October 10, 2013 6:53:02 PM UTC+3:30, Merrill wrote:

john land

unread,
Aug 18, 2014, 12:30:30 PM8/18/14
to libfre...@googlegroups.com
HI Dear Merrill
I have a  FSM 9 and several problems with ur OpenSource codes.I did every things that u said but according to the last infokade post have problems and errors like him . i am a windows Programmer and never work with Cmake or some thing like this and i dont know what can i do because i have made a Game and i wanne use Motion Tracker (FSM9 ) and HMD .
NOW i cant use ur libfreespce EXamples 0.7 and because of that cant make my own codes or Dll s or Active x. plz tell me what can i do 
THANK U 
John  

Merrill

unread,
Aug 18, 2014, 1:01:40 PM8/18/14
to libfre...@googlegroups.com
Hello John,

Can you please confirm that you have followed all of my instructions in the previous post to Infokade?  It is very important that you have the prerequisite software installed (WinDDK, etc) and that the directory structure is laid out as described in that post.  All of this information is in the README for the software as well.  CMake is very easy to use, and the steps that I listed in that email detail the procedure for using CMake.

Thanks,
-Merrill

john land

unread,
Sep 1, 2014, 4:01:01 PM9/1/14
to libfre...@googlegroups.com
Hi
As i said i am a C# Programmer and wanne use fsm9 in my game . because of that  i need ur help to answer my questions. my questions are :
1 - can i use libfreespace.dll with out using libfreespace examples 0.7 ?
2 - how can i use libfreespace examples0.7 and c# togather?
Regards
john

Merrill

unread,
Sep 2, 2014, 4:21:35 PM9/2/14
to libfre...@googlegroups.com
Hi John,

Libfreespace.dll is separate from the libfreespace-examples.  The libfreespace-examples package is a set of example applications that utilize the libfreespace.dll, but you can certainly write your own applications that utilize this DLL.

There is not an official C# wrapper for libfreespace 0.7, but some other customers have been successful in writing their own C# wrappers for this so I know it is possible.

I hope this helps, thanks.

-Merrill
Reply all
Reply to author
Forward
0 new messages