-1

I'm working with a real time application with the robot NAO and i need to read the joints sensors fast, the function getData from ALMemory is too slow. I have seen the example with the modue almemoryfastaccess but i have an error when i run the .exe.

I have read about the almemoryfastaccess module but when i try to connect to the sensors with the function ConnectToVariables(getParentBroker(), fSensorKeys, false) i recieved the following error in the function getDataPtr: "uncaught error pointer serialization not implemented". Does anyone have work with this?. Thanks.

I can't you getData from ALMemory because is too slow for my application.

The code is something like this. It compiles well but when I run the .exe the error appears:

enter image description here

#include <almemoryfastaccess/almemoryfastaccess.h>
#include <boost/shared_ptr.hpp>
#include <string>
#include <vector>
#include <alcommon/albroker.h>
#include <qi/log.hpp>

using namespace AL;
using namespace std;

boost::shared_ptr<AL::ALMemoryFastAccess> fMemoryFastAccess;
vector<string> fSensorKeys;
fSensorKeys.clear();
fSensorKeys.resize(3);
fSensorKeys[0] = "Device/SubDeviceList/HeadPitch/Position/Sensor/Value";
fSensorKeys[1] = "Device/SubDeviceList/HeadYaw/Position/Sensor/Value";
fSensorKeys[2] = "Device/SubDeviceList/LAnklePitch/Position/Sensor/Value";
fMemoryFastAccess->ConnectToVariables(getParentBroker(), fSensorKeys, false); //in this line the error appears.
user4581301
  • 33,082
  • 7
  • 33
  • 54
  • 1
    Recommendation: Show code and the full and unadulterated error message. – user4581301 Apr 17 '23 at 23:06
  • Are you running embedded system or desktop? Can the sensors be read directly or do you need USB/SPI to read them? Are the sensors connected to GPIO? – Thomas Matthews Apr 18 '23 at 00:26
  • Are the sensors interrupt driven or do you have to poll them? – Thomas Matthews Apr 18 '23 at 00:41
  • Reading the sensors is normally fast enough, you just need to run your application directly from NAO cpu and not through network, or if you need to use network, use ethernet instead of wifi. – Alexandre Mazel Apr 18 '23 at 12:11
  • Have a look at this answer, as it show how to get one sensor fast: https://stackoverflow.com/questions/72627941/nao-robot-imu-data-rates/72642451#72642451 – Alexandre Mazel Apr 18 '23 at 12:12

1 Answers1

0

This "fast access" API only works when your module runs in the same process as NAOqi.

When running your code from a remote client (your Windows PC here), it is not possible to achieve real-time data collection.

There are alternatives:

  • cross-compile your module and have it loaded by NAOqi. You'll create a library instead of an executable (see the use of qi_create_lib here). Sadly I do not know how to find the cross-toolchain. You might need to contact the support.
  • you can poll the data less frequently (say every 100ms) by using ALMemory::getListData
  • you can poke for the module called ALMemoryWatcher by running qicli info --show-doc ALMemoryWatcher on the robot. It captures real-time data, but you are meant to collect the data by batches at a lower frequency.
Victor Paléologue
  • 2,025
  • 1
  • 17
  • 27