Skip to content

OscManager

4rzael edited this page Sep 1, 2017 · 5 revisions

OscManager

Role

This script handles everything related to OSC. It is not as important for the user as for the other scripts.

Interface

  • Local IP / Port : Put this computer IP/PORT. Used by other OSC servers to send data to the Unity client.
  • Servers : List of distant servers :
    • drones : the crazyflie-osc inner-server
      • IP / Port : The IP / Port of the distant server (can be localhost)
    • drones_meta : the crazyflie-osc meta-server
      • IP / Port : The IP / Port of the distant server (can be localhost)

Code

This script has several important functions, used by other scripts to send/receive OSC packets.

  • public OSCClient CreateClient(string server)

    • This function takes the name of a distant server and returns a local client (needed to send data to the given server)
  • public void SendOscMessage(OSCClient client, string topic, params object[] values)

    • This function take a local OSC client, a topic name and an array of valyes and sends thoses to a distant server.
  • public void OscSubscribe(string topicRegexLike, OscSubscribeCallback callback)

    • This function take a topic (regexlike, explained below) and a callback that will be fired when Unity receives any message matching the given topic.
    • RegexLike topic : This is an osc topic, but it accepts wildcards (*) and named groups ('{name_of_the_group}'). Named groups captured variables are passed to the callback in the 3rd argument.
Clone this wiki locally