OSC weird behavior - Resolved

#1

Hello,

I’m doing some testing with ossia mostly with the serial protocol. My code is base on Thibaud qml files, but I keep having this error popping at every 5 secondes. Anyone have a idea of what I am missing?

osc::listener::ProcessPacket error: element size must be multiple of four

and in this scenario I have nothing that should connect to the OSC

Here is my code

    import QtQuick 2.0
    import Ossia 1.0 as Ossia

    Ossia.Serial
    {
        function openListening(address) {}
        function closeListening(address) {}

        function onMessage(message) {}// evaluated each time a message is received

        function createTree() {
            return [
            {
                name: "Servo_l",
                type:  Ossia.Type.Int,
                access: Ossia.Access.Set,
                bounding: Ossia.Bounding.Clip,
                request: "l$val",
                repetition_filter: 	
                Ossia.Repetitions.Filtered
            },
            {
                name: "Servo_c",
                type:  Ossia.Type.Int,
                access: Ossia.Access.Set,
                bounding: Ossia.Bounding.Clip,
                request: "c$val",
                repetition_filter: 	
                Ossia.Repetitions.Filtered
            },
            {
                name: "Servo_r",
                type:  Ossia.Type.Int,
                access: Ossia.Access.Set,
                bounding: Ossia.Bounding.Clip,
                request: "r$val",
                repetition_filter: 	
                Ossia.Repetitions.Filtered
            }
            ];
        }
    }
0 Likes

#2

Hi,

what about your serial datagram ?
who is producing it ? an Arduino ? if so, could you post you code and the platform on which it runs.

The error looks like a bug in the serial lib that produces the datagram.

There are many bugs in the CNMAT OSC library for Arduino. @bltzr fixed lots of them but I’m not sure everything has been merge into CNMAT github repo, nor if there is a new release since we made those changes.

0 Likes

#3

hey !

I fixed some errors in the OSC lib, but they were on the receiving end. Something seems to be wrong when packets are made, here… with some more info, hopefully, I could try to help

0 Likes

#4

Hello, here is my code for the arduino, it runs on a fake arduino mega 2560 with a custom shield on top.

#include <Servo.h>

const int servoPins[] = {2, 3 , 4};                                    // non PWM pins for servos  
const int servoNum = sizeof(servoPins) / sizeof(servoPins[0]);        // number of servos

Servo myServos[servoNum];                   // create servo objects

void setup() {
  
  Serial.begin(9600);                       // set baud rate
  
  for (int i = 0; i < servoNum; i++) {
    myServos[i].attach(servoPins[i]);   // define servo range
    myServos[i].writeMicroseconds(500);            // servo initial value
  }
}

void loop() {

  while (Serial.available() > 0) {    
    switch (Serial.read()) { // switch for the folowing characters 
      
      case 'l':
      myServos[0].writeMicroseconds(map(Serial.parseInt(), 0, 180, 500, 2300)); //Writes a value in microseconds (uS) to the servo
      //myServos[0].write(Serial.parseInt());
      break;
      
      case 'c':
      myServos[1].writeMicroseconds(map(Serial.parseInt(), 0, 180, 500, 2300)); //Writes a value in microseconds (uS) to the servo
      //myServos[1].write(Serial.parseInt());
      break;
      
      case 'r':
      myServos[2].writeMicroseconds(map(Serial.parseInt(), 0, 180, 500, 2300)); //Writes a value in microseconds (uS) to the servo
      //myServos[2].write(Serial.parseInt());
      break;
    }
  }
  //Serial.flush();
  //delay(1);
}
0 Likes

#5

For the record, I find the error is not in score but in something on our local network. I have the same issue in different software.

Sorry ¯_(ツ)_/¯

0 Likes