0

I have a Zaber linear stage for which I'm developing a C++ backend, to integrate it in my framework.

I have installed the Zaber API by following the instructions from the Zaber webpage. The installer actually generates the dll, lib, and headers necessary for my backend, and I'm confident that my CMake configuration is correct, because I can instantiate objects from the Zaber API.

So now, I am trying in my framework to go through their first code example:

// I commented out the following block:
//     - enableDeviceDbStore() is supposed to allow the library to cache
//       information from the online database
//     - I don't need the online db
//     - when I call it, it throws a "string too long" exception.
// try
// {
//     zaber::motion::Library::enableDeviceDbStore(".");
// }
// catch (std::exception& e)
// {
//     LogError << e.what();
// }

try
{
    _connection = zaber::motion::ascii::Connection::openSerialPort("COM6");
    // this also throws a "string too long" exception
}
catch (std::exception& e)
{
    std::cout << e.what() << std::endl;
}

std::vector<zaber::motion::ascii::Device> deviceList;
try
{
    deviceList = _connection.detectDevices(false);
    // this throws a "Connection has been closed" exception
}
catch (std::exception& e)
{
    std::count << e.what() << std::endl;
}
std::count << "Found " << deviceList.size() << " devices." << std::endl;

The problem is, when I use the Zaber Launcher (their UI that allows to control a connected stage), the port is "COM6", and I have made sure to close the connection on the Zaber Launcher before trying to connect with my framework.

I have also tried to launch their pre-configured C++ code example (VS17 solution), with the same problems arising (except their example doesn't catch exceptions, so it just crashes).

None of my exception matches their troubleshooting section.

I don't know how to proceed from here, or how to interpret the "string too long" error message, considering that I'm sure of my connection port.

MacroController
  • 322
  • 2
  • 6
  • 19
  • Would you be able to indicate which IDE you are using and what version? Also what Windows version? If you're able to attach a ZIP with all the project files, that may also help replicate and resolve the issue. – ZaberCS Feb 17 '23 at 17:00
  • I'll prepare that and update my question accordingly! – MacroController Feb 20 '23 at 09:10
  • Thanks @ZaberCS, actually trying to produce a working minimal example helped me solve my own problem. I had been skipping the steps in trying to integrate my stage. – MacroController Feb 21 '23 at 14:15
  • 1
    Great to hear! Feel free to check in with us at our customer service email; we're happy to help with troubleshooting and aim to be very responsive (always happy to help on Stack Exchange as well). – ZaberCS Feb 21 '23 at 16:36

2 Answers2

1

Zaber provides the dll files for both debug and release target types, and I initially ignored it, using the release dll files for my debug configuration.

Correcting my CMakeLists and using the correct dll for the correct target types solved my problem (I can control my stage).

MacroController
  • 322
  • 2
  • 6
  • 19
1

With a reputation of just 30, I cannot comment so I am forced to reply here.

Your string too long error message and its cause are described in https://software.zaber.com/motion-library/docs/tutorials/code#_exception-string-too-long, possibly as a result you experiencing and having solved the problem. I add it here so that people know it's not just your "workaround" to the problem, but officially the cause and correct solution, according to Zaber themselves.

Ivan
  • 41
  • 4