Пример #1
0
        /// <summary>
        /// Extends type <c>sensor_msgs.JointState</c> with a method <c>ToJointState</c>, which creates corresponding jointstates
        /// </summary>
        /// <param name="jointState">A time joint states message</param>
        /// <returns>Returns an instance of <c>JointStates</c>.</returns>
        public static JointStates ToJointState(this sensor_msgs.JointState jointState)
        {
            var joints = new JointSet(jointState.name);

            JointValues getJointValues(double[] v) => v != null && v.Length > 0 ? new JointValues(joints, v) : null;

            return(new JointStates(getJointValues(jointState.position), getJointValues(jointState.velocity), getJointValues(jointState.effort)));
        }
Пример #2
0
        public override bool Equals(IRosMessage ____other)
        {
            if (____other == null)
            {
                return(false);
            }
            bool ret = true;

            sensor_msgs.JointState other = (Messages.sensor_msgs.JointState)____other;

            ret &= header.Equals(other.header);
            if (name.Length != other.name.Length)
            {
                return(false);
            }
            for (int __i__ = 0; __i__ < name.Length; __i__++)
            {
                ret &= name[__i__] == other.name[__i__];
            }
            if (position.Length != other.position.Length)
            {
                return(false);
            }
            for (int __i__ = 0; __i__ < position.Length; __i__++)
            {
                ret &= position[__i__] == other.position[__i__];
            }
            if (velocity.Length != other.velocity.Length)
            {
                return(false);
            }
            for (int __i__ = 0; __i__ < velocity.Length; __i__++)
            {
                ret &= velocity[__i__] == other.velocity[__i__];
            }
            if (effort.Length != other.effort.Length)
            {
                return(false);
            }
            for (int __i__ = 0; __i__ < effort.Length; __i__++)
            {
                ret &= effort[__i__] == other.effort[__i__];
            }
            // for each SingleType st:
            //    ret &= {st.Name} == other.{st.Name};
            return(ret);
        }