ccoughlin / gocator_profiler

Sample code for using Gocator 20x0 3D Laser Scanners
6 stars 4 forks source link

GoSystem_Connect Error Code -997 #1

Closed robotsorcerer closed 8 years ago

robotsorcerer commented 8 years ago

Hi Chris,

Trust you are well. I am developing the SDK in ROS for a gocator scanner 2370A system. The API is obviously different from the 3x00 series that you used for your project.

I basically follow the BasicSetup.c example that accompanies the MultiSensor_GoSystem sdk. Here is the code snippet extracted from the basic example:

    callbackContext = new DataContext;          //allocate memory for callback context
    if(!(callbackContext = new DataContext))
    {
        ROS_ERROR("I cannot allocate memory for app context\n Code Line 152");
    }

    // construct Gocator API Library
    if ((status = GoSdk_Construct(&api)) != kOK)
    {
        ROS_ERROR("Error: GoSdk_Construct:%d\n", status);
    }

    // construct GoSystem object
    if ((status = GoSystem_Construct(&system, kNULL)) != kOK)
    {
        ROS_ERROR("Error: GoSystem_Construct:%d\n", status);
    }

    // set callback context to hold GoSystem object handle
    callbackContext->system = system;

    // open command channels to all sensors in system 
    if ((status = GoSystem_Connect(system)) != kOK)
    {
        ROS_ERROR("Error: GoSystem_Connect:%d", status);
    }       

    // enable data channels for all sensors in system
    if ((status = GoSystem_EnableData(system, kTRUE)) != kOK)
    {
        ROS_ERROR("Error: GoSystem_EnableData:%d", status);
    }

    // set data handler to receive data asynchronously
    if ((status = GoSystem_SetDataHandler(system, onData, callbackContext)) != kOK)
    //if ((status = GoSystem_SetDataHandler(system, onData, callbackContext)) != kOK)  //use kNULL to unregister callbackcontext
    {
        ROS_ERROR("Error: GoSystem_SetDataHandler:%d\n", status);
    }   

For some reason, when I run the code, I am stuck with the error:

Error: GoSystem_Connect: -997

It turns out that 997 means invalid parameter in the sdk definitions.

Have you encountered any problem as this in the past? Also, can you stream scan profiles from the ipaddress alone?

ccoughlin commented 8 years ago

Hi Olalekan,

Sorry for the delayed response! I do remember something similar in the 20x0, if I remember correctly it was because there was an initialize method that had to be called first to set up the API's internal data structures. I'm not familiar with the 2370A, does its API have a similar method?

Regards, Chris

On Wed, Jan 13, 2016 at 5:09 AM, Olalekan notifications@github.com wrote:

Hi Chris,

Trust you are well I am developing the SDK in ROS for a gocator scanner 2370A system The API is obviously different from the 3x00 series that you used for your project

I basically follow the BasicSetupc example that accompanies the MultiSensor_GoSystem sdk Here is the code snippet extracted from the basic example:

callbackContext = new DataContext;          //allocate memory for callback context
if(!(callbackContext = new DataContext))
{
    ROS_ERROR("I cannot allocate memory for app context\n Code Line 152");
}

// construct Gocator API Library
if ((status = GoSdk_Construct(&api)) != kOK)
{
    ROS_ERROR("Error: GoSdk_Construct:%d\n", status);
}

// construct GoSystem object
if ((status = GoSystem_Construct(&system, kNULL)) != kOK)
{
    ROS_ERROR("Error: GoSystem_Construct:%d\n", status);
}

// set callback context to hold GoSystem object handle
callbackContext->system = system;

// open command channels to all sensors in system
if ((status = GoSystem_Connect(system)) != kOK)
{
    ROS_ERROR("Error: GoSystem_Connect:%d", status);
}

// enable data channels for all sensors in system
if ((status = GoSystem_EnableData(system, kTRUE)) != kOK)
{
    ROS_ERROR("Error: GoSystem_EnableData:%d", status);
}

// set data handler to receive data asynchronously
if ((status = GoSystem_SetDataHandler(system, onData, callbackContext)) != kOK)
//if ((status = GoSystem_SetDataHandler(system, onData, callbackContext)) != kOK)  //use kNULL to unregister callbackcontext
{
    ROS_ERROR("Error: GoSystem_SetDataHandler:%d\n", status);
}

For some reason, when I run the code, I am stuck with the error:

Error: GoSystem_Connect: -997

It turns out that 997 means invalid parameter in the sdk definitions

Have you encountered any problem as this in the past? Also, can you stream scan profiles from the ipaddress alone?

— Reply to this email directly or view it on GitHub https://github.com/ccoughlin/gocator_profiler/issues/1.

Chris Coughlin chriscoughlin@gmail.com http://www.chriscoughlin.com

robotsorcerer commented 8 years ago

Hi Chris,

Thank you for your response. I fixed it by upgrading my firmware to the latest version from the LMI3D website. I appreciate your response.

Was there any way you retrieved the profile map/surface scan map from the sensor itself?

ccoughlin commented 8 years ago

Glad you got it up and running. I've never tried getting it directly from the sensor, I'd just go through the API and store it to disk if I remember correctly. I had planned on looking at what the Gocator UI does at some point though; at the time it was using a Flash based web app so my thought was I should be able to just monitor the network connection and figure out how it managed things.

On Sunday, January 17, 2016, Olalekan notifications@github.com wrote:

Hi Chris,

Thank you for your response. I fixe it by upgrading my firmware to the latest version from the LMI3D website. I appreciate your response.

Was there any way you retrieved the profile map/surface scan map from the sensor itself?

— Reply to this email directly or view it on GitHub https://github.com/ccoughlin/gocator_profiler/issues/1#issuecomment-172354382 .

Sent from a mobile device

robotsorcerer commented 8 years ago

Thank you! I'll try putting the surface map on an opencv window and let you know what I find.

ccoughlin commented 8 years ago

Great! I'm curious what kind of results you get. Good luck!

On Monday, January 18, 2016, Olalekan notifications@github.com wrote:

Thank you! I'll try putting the surface map on an opencv window and let you know what I find.

— Reply to this email directly or view it on GitHub https://github.com/ccoughlin/gocator_profiler/issues/1#issuecomment-172625563 .

Sent from a mobile device

robotsorcerer commented 8 years ago

How do you like these point cloud windows?

pointcloud2

pointcloud

ccoughlin commented 8 years ago

Nice, looks like it's coming along! Any trouble with junk sensor readings? The 3x00 has some amount of bad reading filtration built-in but we had trouble with glossy surfaces esp. with curves.

On Thu, Feb 25, 2016 at 3:46 PM, Olalekan notifications@github.com wrote:

How do you like these point cloud window?

[image: pointcloud2] https://cloud.githubusercontent.com/assets/8429860/13335485/5822fa06-dbdf-11e5-8c88-f960bf0d98d6.png

[image: pointcloud] https://cloud.githubusercontent.com/assets/8429860/13335486/59160df4-dbdf-11e5-891e-4f1b67ab6510.png

— Reply to this email directly or view it on GitHub https://github.com/ccoughlin/gocator_profiler/issues/1#issuecomment-189000779 .

Chris Coughlin chriscoughlin@gmail.com http://www.chriscoughlin.com

robotsorcerer commented 8 years ago

I have not experienced junk readings as of now. I just operate it in profile and surface modes as of now.

hey, a quick question here: when you integrated the encoder into the sensor, did you program the sensor to trigger based on motion sensed as a result of encoder readings?

If you did, a guide would be helpful. I have looked at this and the sdk api's. I am not aware if there is any special method to allow the sensor to retrieve the encoder readings and strobe the camera based on sensed motion. I was wondering if you hardcoded the sensor motion or you synced the sensor motion to the encoder.

Would appreciate your help!

ccoughlin commented 8 years ago

Sure did, I think we used an RLS LM10 ( http://www.rls.si/products/linear-magnetic-encoders/lm10-linear-magnetic-encoder-system) if I remember correctly. If the SDK isn't all that different I think you're interested in the Go2Data_ItemCount and Go2Data_Encoder functions. LMI's got sample C code up @ http://support.lmi3d.com/kb_cat.php?s=bb8373974e3904d0398fa8b3f5887606&id=41&t=qanda . The code I wrote is in gocatorcontrol.cxx (with the different types of trigger in include/gocatorcontrol.h).

On Fri, Mar 18, 2016 at 3:08 PM, Olalekan notifications@github.com wrote:

I have not experienced junk readings as of now. I just operate it in profile and surface modes as of now.

hey, a quick question here: when you integrated the encoder into the sensor, did you program the sensor to trigger based on motion sensed as a result of encoder readings?

If you did, a guide would be helpful. I have looked at this http://lmi3d.com/manuals/gocator/gocator-4.3/G2/Default.htm#WebInterface/Scan/TriggerPanel/TriggerPanel.htm%3FTocPath%3DGocator%20Web%20Interface%7CScan%20Setup%20and%20Alignment%7CTriggers%7C_____0 and the sdk api's. I am not aware if there is ant special method to allow the sensor to retrieve the encoder readings and strobe the camera based on sensed motion.

Would appreciate your help!

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/ccoughlin/gocator_profiler/issues/1#issuecomment-198520752

Chris Coughlin chriscoughlin@gmail.com http://www.chriscoughlin.com

robotsorcerer commented 8 years ago

Thank you very much! This is very helpful.

Sincerely, Lekan

On Mar 20, 2016, at 10:58 AM, Chris Coughlin notifications@github.com wrote:

Sure did, I think we used an RLS LM10 ( http://www.rls.si/products/linear-magnetic-encoders/lm10-linear-magnetic-encoder-system) if I remember correctly. If the SDK isn't all that different I think you're interested in the Go2Data_ItemCount and Go2Data_Encoder functions. LMI's got sample C code up @ http://support.lmi3d.com/kb_cat.php?s=bb8373974e3904d0398fa8b3f5887606&id=41&t=qanda . The code I wrote is in gocatorcontrol.cxx (with the different types of trigger in include/gocatorcontrol.h).

On Fri, Mar 18, 2016 at 3:08 PM, Olalekan notifications@github.com wrote:

I have not experienced junk readings as of now. I just operate it in profile and surface modes as of now.

hey, a quick question here: when you integrated the encoder into the sensor, did you program the sensor to trigger based on motion sensed as a result of encoder readings?

If you did, a guide would be helpful. I have looked at this http://lmi3d.com/manuals/gocator/gocator-4.3/G2/Default.htm#WebInterface/Scan/TriggerPanel/TriggerPanel.htm%3FTocPath%3DGocator%20Web%20Interface%7CScan%20Setup%20and%20Alignment%7CTriggers%7C_____0 and the sdk api's. I am not aware if there is ant special method to allow the sensor to retrieve the encoder readings and strobe the camera based on sensed motion.

Would appreciate your help!

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/ccoughlin/gocator_profiler/issues/1#issuecomment-198520752

Chris Coughlin chriscoughlin@gmail.com http://www.chriscoughlin.com — You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub

robotsorcerer commented 8 years ago

Is that RLS LM10 RS-485 compliant? I have been using the EPOS 24/5 and it seems it is only RS-232 compliant which may explain why it doesn't work as I thought it should.

ccoughlin commented 8 years ago

I think it was RS422 actually, but if your encoder is 232 the conversion dongle can be had for around $20. I seem to recall there's a way to "fake" the connection by shorting pins on both sides but I wouldn't recommend it.

On Monday, March 21, 2016, Olalekan notifications@github.com wrote:

Is that RLS LM10 RS-485 compliant? I have been using the EPOS 24/5 http://www.maxonmotorusa.com/maxon/view/product/control/Positionierung/367676 and it seems it is only RS-232 compliant which may explain why it doesn't work as I thought it should.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/ccoughlin/gocator_profiler/issues/1#issuecomment-199374032

Sent from a mobile device

robotsorcerer commented 8 years ago

The Gocator 2370 does provide an imager. Look what I got

pointcloud_pink

point_cloud_pink2

ccoughlin commented 8 years ago

Nice! Are you planning to use point cloud library for processing?

On Thursday, March 24, 2016, Olalekan notifications@github.com wrote:

The Gocator 2370 does provide an imager. Look what I got

[image: pointcloud_pink] https://cloud.githubusercontent.com/assets/8429860/14023312/424b7afa-f1ba-11e5-8950-40b3082b8373.png

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/ccoughlin/gocator_profiler/issues/1#issuecomment-200907087

Sent from a mobile device

robotsorcerer commented 8 years ago

Yes, I am using the point cloud library! You have a better suggestion? :)

ccoughlin commented 8 years ago

Nope, PCL's probably the way to go. Was curious if you were going to use it for surface reconstruction, that sort of thing.

On Thursday, March 24, 2016, Olalekan notifications@github.com wrote:

Yes, I am using the point cloud library! You have a better suggestion? :)

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/ccoughlin/gocator_profiler/issues/1#issuecomment-200908619

Sent from a mobile device