Exemplo n.º 1
0
 public void Setup()
 {
     RosSocket = new RosSocket(new RosBridgeClient.Protocols.WebSocketNetProtocol(Uri));
 }
Exemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     this.RosSocket = this.RosConnector.RosSocket;
 }
Exemplo n.º 3
0
 // Start is called before the first frame update
 void Start()
 {
     // Subscribe once to joint_states ROS topic for raven2 robot
     rosSocket = GameObject.Find("ROSConnection").GetComponent <ROSConnection>().getRosSocket();
     string subscription_id = rosSocket.Subscribe <sensor_msgs.JointState>("/joint_states", JointStateHandler);
 }
Exemplo n.º 4
0
 public void Awake()
 {
     RosSocket = new RosSocket(RosBridgeServerUrl);
     Debug.Log("Connected to RosBridge: " + RosBridgeServerUrl);
 }
Exemplo n.º 5
0
        void Update()

        //  public static void Main(string[] args)

        {
            if (help == true)
            {
                help = false;



                //RosSocket rosSocket = new RosSocket(new RosBridgeClient.Protocols.WebSocketSharpProtocol(uri));

                RosSocket rosSocket = new RosSocket(new RosBridgeClient.Protocols.WebSocketNetProtocol(uri));



                // Publication:

                std_msgs.String message = new std_msgs.String

                {
                    data = "publication test masdasdessage data"
                };



                string publication_id = rosSocket.Advertise <std_msgs.String>("publication_test");

                rosSocket.Publish(publication_id, message);



                // Subscription:

                string subscription_id = rosSocket.Subscribe <std_msgs.String>("/subscription_test", SubscriptionHandler);

                subscription_id = rosSocket.Subscribe <std_msgs.String>("/subscription_test", SubscriptionHandler);



                // Service Call:

                rosSocket.CallService <rosapi.GetParamRequest, rosapi.GetParamResponse>("/rosapi/get_param", ServiceCallHandler, new rosapi.GetParamRequest("/rosdistro", "default"));



                // Service Response:

                string service_id = rosSocket.AdvertiseService <std_srvs.TriggerRequest, std_srvs.TriggerResponse>("/service_response_test", ServiceResponseHandler);



                //Console.WriteLine("Press any key to unsubscribe...");
                Debug.Log("Press any key to unsubscribe...");
                // Console.ReadKey(true);

                rosSocket.Unadvertise(publication_id);

                rosSocket.Unsubscribe(subscription_id);

                rosSocket.UnadvertiseService(service_id);



                //Console.WriteLine("Press any key to close...");
                Debug.Log("Press any key to close...");
                //Console.ReadKey(true);

                rosSocket.Close();



                help = true;
            }
        }
Exemplo n.º 6
0
 public ServiceReceiver(RosSocket rosSocket, string service, Tin parameter, object handlerParameter)
 {
     ServiceParameter = parameter;
     HandlerParameter = handlerParameter;
     rosSocket.CallService <Tin, Tout>(service, Receive, ServiceParameter);
 }
Exemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     rosSocket      = GameObject.Find("drone").GetComponent <RosConnector>().RosSocket;
     droneBody      = GameObject.Find("drone").GetComponent <Rigidbody>();
     publication_id = rosSocket.Advertize("drone/gps", "sensor_msgs/NavSatFix");
 }
 public void Init()
 {
     rosSocket = GetComponent <HSR_Connector>().RosSocket;
     rosSocket.Subscribe("/yolo_object_coordinate", "visualization_msgs/MarkerArray", Yolo_Res, UpdateTime);
 }
 public OdometryHandler(ISourceTree container, RosSocket socket, string topic) : base(
         container, socket, topic)
 {
 }
Exemplo n.º 10
0
        void Start()
        {
            GameObject Connector = GameObject.FindWithTag("Connector");

            socket = Connector.GetComponent <RosConnector>()?.RosSocket;
        }