title: ROS# ROS to Unity communication : problem with creation of a new MessageType
body: <p>I'm currently working on a sonar named &quot;Imagenex 831L&quot; and I'm trying to extract the data published by a driver with ROS and send it to Unity with RosBridge and ROS#. So I'm trying to subscribe to this topic and visualize it on Unity.</p>
  <p>My problem is that the topic generated by the driver isn't a native topic of ROS, it's created by the driver and it's not known by the ROS# library.</p>
  <p>I tried this method to create a new MessageType : <a href="https://github.com/siemens/ros-sharp/wiki/Dev_NewMessageTypes" rel="nofollow noreferrer">https://github.com/siemens/ros-sharp/wiki/Dev_NewMessageTypes</a> but that doesn't work at all.
  I've also thought to change the MessageType created by the driver but I'm a begginer in ROS and I don't want to messed up the driver.</p>
  <p>So I started a script in C# to create a new message type but I'm really not sure if this gonna work. As you can see below my code to create a new MessageType :</p>
  <pre><code>using RosSharp.RosBridgeClient.MessageTypes.Std;
  
      namespace RosSharp.RosBridgeClient.MessageTypes.imagenex831l
      {
          public class ProcessedRange : Message
          {
              public const string RosMessageName = &quot;imagenex831l/ProcessedRange&quot;;
              public float Head_position { get; set; }
              public UInt8 Intensity { get; set; }
      
              public ProcessedRange() { }
              public ProcessedRange(Header header, UInt8[] Intensity, float Head_position) { }
      
              public Header header { get; set; }
      
          }
      }
  </code></pre>
  <p>Then I tried to code a subscriber :</p>
  <pre><code>using RosSharp.RosBridgeClient.MessageTypes.imagenex831l;
  using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using RosSharp.RosBridgeClient.MessageTypes.Std;
  
  namespace RosSharp.RosBridgeClient
  {
      public class ProcessedRangeSuscriber : UnitySubscriber&lt;MessageTypes.imagenex831l.ProcessedRange&gt;
      {
          //public Transform PublishedTransform;
  
          public UInt8[] Intensity;
          public Float32 Head_position;
          private bool isMessageReceived;
  
          protected override void Start()
          {
              base.Start();
          }
  
          private void Update()
          {
              if (isMessageReceived)
                  ProcessMessage();
          }
  
          protected override void ReceiveMessage(MessageTypes.imagenex831l.ProcessedRange message)
          {
              //position = GetPosition(message).Ros2Unity();
              //rotation = GetIntensity(message).Ros2Unity();
              //isMessageReceived = true;
          }
  
          private void ProcessMessage()
          {
              //PublishedTransform.position = position;
              //PublishedTransform.rotation = rotation;
          }
  
          private Float32 GetPosition(MessageTypes.imagenex831l.ProcessedRange message)
          {
              return new Float32(message.head_position);
          }
  
          private UInt8 GetIntensity(MessageTypes.imagenex831l.ProcessedRange message)
          {
              return new UInt8(message.intensity);
          }
      }
  }
  </code></pre>
  <p>I get the following error message : CS1503  C# Argument 1: cannot convert from to 'byte'</p>
  <p>If someone has also use this sonar or know ROS# I'm very interesting to discuss with them.</p>
  <p>Thank you for your consideration regarding my request</p>