Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

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]