Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

NotImplementedException thrown when using JointTrajectory & JointTrajectoryPoint Messages

Discussion in 'Robotics' started by jasmeet-ty, Aug 17, 2021.

  1. jasmeet-ty

    jasmeet-ty

    Joined:
    Jul 20, 2021
    Posts:
    4
    Hi, I am trying to send JointTrajectory Message on a topic in ROS from unity. I noticed that the ROS-TCP_Connector package in unity already comes with C# classes of many messages including the JointTrajectory and JointTrajectoryPoint messages. I am trying to use those as follows in a script:

    Code (CSharp):
    1.  
    2. JointTrajectoryPointMsg[] trajectoryPointMessage = new JointTrajectoryPointMsg[1];
    3. trajectoryPointMessage[0] = new JointTrajectoryPointMsg();
    4.  
    5. trajectoryPointMessage[0].positions = jointAngles;
    6. trajectoryPointMessage[0].velocities = new double[0];
    7. trajectoryPointMessage[0].accelerations = new double[0];
    8. trajectoryPointMessage[0].effort = new double[0];
    9.  
    10.  
    11. JointTrajectoryMsg trajectoryCommandMessage = new JointTrajectoryMsg();
    12.  
    13. trajectoryCommandMessage.joint_names = jointNames;
    14. trajectoryCommandMessage.points = trajectoryPointMessage;
    here jointAngles is a double array and jointNames is string array. Running this script seems to throw NotImplementedException but I am able to figure out the reason. I have tried using custom messages as well as some messages from std_msgs and all of them work. But JointTrajectory messages are throwing the exception.
     
  2. jasmeet-ty

    jasmeet-ty

    Joined:
    Jul 20, 2021
    Posts:
    4
    Okay so I was able to resolve this error. The problem was that the DurationMsg script in HandwrittenMsg did not override the SerializeTo method. Since, this is used in JointTrajectoryPointMsg, it was throwing an NotImplementedException as it was executing the SerializeTo function from base class. So I just added a SerializeTo method to DurationMsg.cs and it works!
     
  3. vidurVij-Unity

    vidurVij-Unity

    Unity Technologies

    Joined:
    Feb 26, 2020
    Posts:
    8
    Thank you for bringing this to our attention. We have created an internal ticket for this bug and will push a fix in the future. [AIRO-1163]