Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

FollowJointTrajectory Action does not generate Register code

Discussion in 'Robotics' started by Pascal-Serrarens, Nov 22, 2021.

  1. Pascal-Serrarens


    Jan 14, 2013
    Using version 0.6.0 of the ROS TCP Connector I am working on a action interface for a Joint Trajectory Controller.
    For this I generated the code for FollowJointTrajectory.action using the standard 'Generate ROS Messages...' and the message code for the action found here

    However, when I try to register a publisher for the ActionFeedback:

    feedbackTopic = ros.RegisterPublisher<FollowJointTrajectoryActionFeedback>(feedbackTopicName);

    I experience a lot of errors at the ROS side: Failed to resolve message name: list index out of range
    And on the Unity side: SysCommand.publish - Unknown message class ''

    Further investigation shows that the the FollowJointTrajectoryActionFeedback is not registered in the MessageRegistry. As a result of that, the name of the message is not set, causing the error messages above.

    Other other generated messages like FollowJointTrajectoryFeedback (without Action in the name) have explicit code for Registering. When I add this code to the generated FollowJointTrajectoryActionFeedback code, the errors are resolved:
    Code (CSharp):
    1. #if UNITY_EDITOR
    2.         [UnityEditor.InitializeOnLoadMethod]
    3. #else
    4.         [UnityEngine.RuntimeInitializeOnLoadMethod]
    5. #endif
    6.         public static void Register() {
    7.             MessageRegistry.Register(k_RosMessageName, Deserialize, MessageSubtopic.Feedback);
    8.         }
    Is this a bug or am I not supposed to register an ActionFeedback topic?
    I took inspiration for this implementation from the Pick-and-Place tutorial part 4:

    Pascal Serrarens.
  2. LaurieUnity


    Unity Technologies

    Oct 23, 2020
    Ah, yes, that is a bug. Thanks for the report. (Filed as AIRO-1571).
    Currently our support for ROS Actions is fairly minimal, but we hope to support them better in future.
  3. Pascal-Serrarens


    Jan 14, 2013
    Thank you for confirming this.
    In the meantime I found that there are indeed more issues with the ActionLib support (the deserialization of a Action Goal message failes with a NullPointer exception).
    On the other hand, in our project we found that we do not need the Action Interface on a short term, so we decide to postpone this part for now.
    (On the other hand: we will probably need support for the Parameter Server for which we also may need to implement a custom solution for the time being...)
  4. mrpropellers


    Unity Technologies

    Jul 10, 2019
    Full transparency: support for the rosparam API is very deep in our backlog and I wouldn't count on us getting it any time soon unless some priorities change. You should be able to implement a reasonable workaround by writing a ROS-side component which polls your param values and publishes them via a custom parameter msg to Unity. Depending on how runtime-immutable your parameters are and whether they are scattered throughout ROS launch files or defined in specific yamls/jsons, you may even be able to parse the configs directly in Unity using one of the many open-source C# libraries for yaml/json parsing.