private RosPublish deserializeJointTrajectory(JsonObject jsonObject)
        {
            JsonArray jjoint_names = jsonObject["msg"].GetObject()["joint_names"].GetArray();


            // baue den Header
            Header header = RosHeaderCoder_.deserializeSingleHeader((JsonValue)jsonObject["msg"].GetObject()["header"]);

            // Lasse die JointTrajectoryPoints vom jeweiligen Coder deserialisieren

            JsonArray jjointtrajectorypoints = jsonObject["msg"].GetObject()["points"].GetArray();

            //TODO JointTrajectoryPoints deserialisieren
            JointTrajectoryPoint[] pts = new JointTrajectoryPoint[jjointtrajectorypoints.Count];
            for (int i = 0; i < jjointtrajectorypoints.Count; i++)
            {
                pts[i] = RosJointTrajectoryPointCoder_.deserializeSingleJointTrajectoryPoint((JsonValue)jjointtrajectorypoints[i]);
            }


            JointTrajectory messageData = new JointTrajectory();

            messageData.header = header;
            // Nutze den ArrayService, um die JSONArrays in "normale" Arrays umzuwandeln
            messageData.joint_names = RosArrayService_.stringArrayAusJSonArray(jjoint_names);
            messageData.points      = pts;


            return(new RosPublish("\"/preview_trajectory\"", messageData));
        }
Esempio n. 2
0
        private RosPublish deserializeJointState(JsonObject jsonObject)
        {
            JsonArray jnarray = jsonObject["msg"].GetObject()["name"].GetArray();
            JsonArray jparray = jsonObject["msg"].GetObject()["position"].GetArray();
            JsonArray jvarray = jsonObject["msg"].GetObject()["velocity"].GetArray();
            JsonArray jearray = jsonObject["msg"].GetObject()["effort"].GetArray();

            // baue den Header
            Header header = RosHeaderCoder_.deserializeSingleHeader((JsonValue)jsonObject["msg"].GetObject()["header"]);

            //Restliche Werte des JointState rausfinden

            JointState messageData = new JointState();

            messageData.header = header;
            // Nutze den ArrayService, um die JSONArrays in "normale" Arrays umzuwandeln
            messageData.name     = RosArrayService_.stringArrayAusJSonArray(jnarray);
            messageData.position = RosArrayService_.doubleArrayAusJSonArray(jparray);
            messageData.velocity = RosArrayService_.doubleArrayAusJSonArray(jvarray);
            messageData.effort   = RosArrayService_.doubleArrayAusJSonArray(jearray);

            return(new RosPublish("\"/joint_states\"", messageData));
        }