コード例 #1
0
        /**
         * \brief Waits for the ActionServer to connect to this client
         * Often, it can take a second for the action server & client to negotiate
         * a connection, thus, risking the first few goals to be dropped. This call lets
         * the user wait until the network connection to the server is negotiated
         * NOTE: Using this call in a single threaded ROS application, or any
         * application where the action client's callback queue is not being
         * serviced, will not work. Without a separate thread servicing the queue, or
         * a multi-threaded spinner, there is no way for the client to tell whether
         * or not the server is up because it can't receive a status message.
         * \param timeout Max time to block before returning. A zero timeout is interpreted as an infinite timeout.
         * \return True if the server connected in the allocated time. False on timeout
         */
        public bool waitForActionServerToStart(duration timeout = default(duration))
        {
            int sleepTime = (int)(timeout.data.sec * 1000 + timeout.data.nsec / 1000000);

            Thread.Sleep(sleepTime);
            // if ros::Time::isSimTime(), then wait for it to become valid
//			if(!ros::Time::waitForValid(ros::WallDuration(timeout.sec, timeout.nsec)))
//				return false;

            if (connectionMonitor != null)
            {
                return(connectionMonitor.waitForActionServerToStart(timeout, nodeHandle));
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
ファイル: _Init.cs プロジェクト: YaseenAlk/ROS.NET
 /// <summary>
 /// Convert std_msgs/Duration into TimeSpan struct
 /// </summary>
 /// <param name="time"> std_msgs.Duration to convert </param>
 /// <returns> a TimeSpan </returns>
 public static TimeSpan ToTimeSpan(this std_msgs.Duration duration)
 {
     return(new TimeSpan(duration.data.Ticks));
 }
コード例 #3
0
 /// <summary>
 ///     Turns a std_msgs.Duration into a TimeSpan
 /// </summary>
 /// <param name="time"> std_msgs.Duration to convert </param>
 /// <returns> a TimeSpan </returns>
 public static TimeSpan GetTime(m.Duration duration)
 {
     return(new TimeSpan(ticksFromData(duration.data)));
 }