Custom Server in VOXL MPA
-
Hello,
I'm planning to create a custom server, which calls for reading essential data(i.e features detected, no. of points detected) from voxl-qvio-server. I'm planning on referring to the libmodal-pipe documentation link for building the server. I have few queries ie.
- I see the reference files here. Once I define my server, how and where do I build the server and integrate it within the existing MPA?
-
@Jetson-Nano , it looks like your server will also be a mpa client - it will need to subscribe to the data from
voxl-qvio-server
. After processing the data, will you need to publish something from your server?You can get started by using the following tool / example (
voxl-inspect-vio
) : https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-mpa-tools/-/blob/master/tools/voxl-inspect-vio.c which you may have already used on VOXL2. The example subscribes to the vio output and prints out some data to the terminal. You can extend this example to achieve what you need. In terms of building the application, you can see how the tools are built in this repo and follow the same structure to add your application to a separate project or to your own copy of thevoxl-mpa-tools
project.Alex
-
@Alex-Kushleyev thank you for reverting,
I would like to subscribe data from the MPA pipe(features detected, no. of points detected) and give a condition , and if the condition is true runvoxl-send-neopixel-cmd
.
so i would like to know.- How to subscribe data inside or outside a server.
- Can I run the
voxl-send-neopixel-cmd
command inside a c++ file, if yes how, could you help me with the approach. Can a custom client get the data and start the command.
@tom
-
@Jetson-Nano , I believe you should be able to prototype something by using the
voxl-inspect-vio
tool, as I mentioned above. You can build a custom version of it and modify the code to send out the following command, when you are ready, to control the neopixels. Please double check the code to make sure it does not have any issues (buffer overflow, etc.. it should not..), I am providing it just for referencestd::string cmd = "voxl-send-neopixel-cmd"; //modify as needed std::string response; char temp_buf[512]; FILE *fp = popen(cmd.c_str(), "r"); if (fp == NULL){ printf("Failed to run command\n"); } else{ //read response from the process while (fgets(temp_buf, sizeof(temp_buf), fp)) { response += temp_buf; } pclose(fp); printf("got response:\n"); printf("%s\n",response.c_str()); }
-
@Alex-Kushleyev thank you for reverting back.
I made the changes in thevoxl-inspect-qvio
tool sincevoxl-inspect-vio
is not visible on the latest version of sdk. will it work.
due to a error from my end, I mentioned c++ file instead of c file, and sincevoxl-inspect-qvio
isc file
i had convert the code toc file
.
I also want to know can I automate thecustom voxl-inspect-qvio tool
when once the board is powered the tool will start without running thecustom voxl-inspect-qvio
command. -
You could convert C to C++ easily if you need to, often for simple code it is just renaming .c to .cpp should do it and update Cmake to use the new source. In any case, it looks like you have it working.
In order to auto start your application on boot, you should write a systemd service as we do for all modalai services on voxl2.
Here is an example service file for voxl-camera-server : https://gitlab.com/voxl-public/voxl-sdk/services/voxl-camera-server/-/blob/master/services/voxl-camera-server.service
Systemd is standard on ubuntu linux, so you should be able to find plenty of documentation if you need help with writing service files.
Alex