public void BeginRosImport(RosConnector.Protocols protocolType, string serverUrl, int timeout, string assetPath)
        {
            this.timeout   = timeout;
            this.assetPath = assetPath;

            // initialize
            ResetStatusEvents();

            rosSocket = RosConnector.ConnectToRos(protocolType, serverUrl, OnConnected, OnClosed);

            if (!StatusEvents["connected"].WaitOne(timeout * 1000))
            {
                Debug.LogWarning("Failed to connect to ROS before timeout");
                return;
            }

            ImportAssets();
        }
        public void TransferUrdf(Protocols.Protocol protocolType, string serverUrl, int timeout, string assetPath, string urdfParameter, RosSocket.SerializerEnum serializer)
        {
            this.timeout       = timeout;
            this.assetPath     = assetPath;
            this.urdfParameter = urdfParameter;

            // initialize
            ResetStatusEvents();

            rosSocket = RosConnector.ConnectToRos(protocolType, serverUrl, OnConnected, OnClosed, serializer);

            if (!StatusEvents["connected"].WaitOne(timeout * 1000))
            {
                Debug.LogWarning("Failed to connect to ROS before timeout");
                return;
            }

            ImportAssets();
        }
Esempio n. 3
0
        private void TransferAsync(Protocols.Protocol protocolType, string serverUrl, int timeout, string urdfPath, string rosPackage, RosSocket.SerializerEnum serializer)
        {
            RosSocket = RosConnector.ConnectToRos(protocolType, serverUrl, OnConnected, OnClose, serializer);

            if (!StatusEvents["connected"].WaitOne(timeout * 1000))
            {
                Debug.LogWarning("Failed to connect to " + serverUrl + " before timeout.");
                RosSocket.Close();
                return;
            }

            string            robotName         = Path.GetFileName(urdfPath);
            UrdfTransferToRos urdfTransferToRos = new UrdfTransferToRos(RosSocket, robotName, urdfPath, rosPackage);

            StatusEvents["robotNamePublished"]        = urdfTransferToRos.Status["robotNamePublished"];
            StatusEvents["robotDescriptionPublished"] = urdfTransferToRos.Status["robotDescriptionPublished"];
            StatusEvents["resourceFilesSent"]         = urdfTransferToRos.Status["resourceFilesSent"];

            urdfTransferToRos.Transfer();
        }