ModalAI Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Question on developing custom services

    VOXL SDK
    2
    3
    376
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jmltt
      last edited by

      I've developed, deployed and tested a mocap-server on the Sentinel dev drone by using voxl-cross to build a deb package. I'm still fairly new to software development so I've been learning a lot just by reading the source code in the sdk.

      I have this mocap-server working, but I've only run it as an executable and I was wondering how to get it running as a background service and how to use a config file to replace some of the variable values I'm hard-coding in like socket addresses. Can someone point me to some example code or recommend the simplest service in the sdk to try to learn how that works on voxl2 (both for setting up a program as a background service and integrating config files)?

      Also, generally speaking when I just kill power to the drone is that bypassing the ability of the services that are running to "close cleanly"? I have zmq pub/sub sockets to get mocap data from the host pc to the drone so if I do get it running as a background service I want to make sure I tear down the sockets and context every time before I power down. Would systemctl stop <service-name> be caught by a signal handler or would I have to figure out a different way to close cleanly? If that's already being done for another service/program in the sdk can someone point me to that?

      tomT 1 Reply Last reply Reply Quote 0
      • tomT
        tom admin @jmltt
        last edited by

        @josephmlullo Here is an example of how voxl-camera-server uses a systemd service to run as a background service on boot:

        https://gitlab.com/voxl-public/voxl-sdk/services/voxl-camera-server/-/blob/master/services/voxl-camera-server.service?ref_type=heads

        Our make_package.sh script installs this file into /etc/systemd/system/: https://gitlab.com/voxl-public/voxl-sdk/services/voxl-camera-server/-/blob/master/make_package.sh?ref_type=heads#L149

        and the service can be enabled on boot with: systemctl enable voxl-camera-server

        Here is an example of how we generate a config file using a one-time "configure" script that all of our services have: https://gitlab.com/voxl-public/voxl-sdk/services/voxl-vision-hub/-/blob/master/scripts/voxl-configure-vision-hub?ref_type=heads

        This allows us to generate a JSON file that lives in /etc/modalai that the service can then read from at run-time

        J 1 Reply Last reply Reply Quote 0
        • J
          jmltt @tom
          last edited by

          @tom Perfect, thanks! I'll check these out

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB | Contributors