Esempio n. 1
0
 ///<exclude/>
 public bool Equals(Twist other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return other.linear.Equals(linear) && other.angular.Equals(angular);
 }
        // ================================================================================================
        /// <summary>
        /// 送信
        /// </summary>
        public void Publish()
        {
            try
            {
                // ロータリーエンコーダ パルス値
                if (null != pubRE)
                {
                    var data = new RosSharp.geometry_msgs.Twist() { linear = new Vector3() { x = reRpulse, y = reLpulse, z = 0.0 } };
                    //Console.WriteLine("data = {0}", data.data);
                    pubRE.OnNext(data);
                }

                // ロータリーエンコーダ プロット値
                if (null != pubPlot)
                {
                    var data = new RosSharp.geometry_msgs.Twist() { linear = new Vector3() { x = rePlotX, y = rePlotY, z = 0.0 }, angular = new Vector3() { x = reAng, y = 0, z = 0 } };
                    //Console.WriteLine("data = {0}", data.data);
                    pubPlot.OnNext(data);
                }

                // 地磁気
                if (null != pubCompus)
                {
                    var data = new RosSharp.geometry_msgs.Twist() { linear = new Vector3() { x = 0.0, y = 0.0, z = compusDir } };
                    //Console.WriteLine("data = {0}", data.data);
                    pubCompus.OnNext(data);
                }

                // GPS
                if (null != pubGPS)
                {
                    var data = new RosSharp.geometry_msgs.Twist() { linear = new Vector3() { x = gpsGrandX, y = gpsGrandY, z = 0.0 } };
                    //Console.WriteLine("data = {0}", data.data);
                    pubGPS.OnNext(data);
                }

                // URG
                if (null != pubUrg)
                {

                    //var data = new RosSharp.sensor_msgs.LaserScan(); // { linear = new Vector3() { x = gpsGrandX, y = gpsGrandY, z = 0.0 } };
                    //Console.WriteLine("data = {0}", data.data);
                    var data = MakeLaserScanData();

                    pubUrg.OnNext(data);
                }

                if (null != pubClock)
                {
                    var data = new RosSharp.rosgraph_msgs.Clock()  { clock = DateTime.Now };
                    pubClock.OnNext(data);
                }

                // LED
                if (null!= pubBenzLED)
                {
                    var data = new RosSharp.std_msgs.String() { data = ledCommand };
                    pubBenzLED.OnNext(data);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }