public static void sendUpdateMessage(string strMessage)
        {
            StandardString message = new StandardString();

            message.data = strMessage;
            rosSocket.Publish(updateID, message);
        }
Пример #2
0
 public void PublishPlan()
 {
     MoveitTarget.left_arm  = UpdateMessageContents(LeftTargetModel);
     MoveitTarget.right_arm = UpdateMessageContents(RightTargetModel);
     Debug.Log("Sending plan request");
     rosSocket.Publish(planPublicationId, MoveitTarget);
 }
Пример #3
0
        protected void PublishStatus()
        {
            ActionStatus = new Messages.Actionlib.GoalStatus() { status = (int)ActionState };

            rosSocket.Publish(StatusPublicationId,
                new Messages.Actionlib.GoalStatusArray { status_list = new Messages.Actionlib.GoalStatus[] { ActionStatus } });
        }
Пример #4
0
 protected void PublishStatus()
 {
     socket.Publish(statusPublicationId,
                    new GoalStatusArray
     {
         status_list = new GoalStatus[]
         {
             new GoalStatus {
                 status = (byte)actionStatus
             }
         }
     }
                    );
 }
Пример #5
0
        public void Update()
        {
            if (velSub.actionReceived == true)
            {
                Vector3 screenPoint     = cam.WorldToViewportPoint(ball.transform.position);
                bool    onScreen        = screenPoint.z > 0 && screenPoint.x > 0 && screenPoint.x < 1 && screenPoint.y > 0 && screenPoint.y < 1;
                float   currentDistance = Vector3.Distance(ball.transform.position, turtle.transform.position);

                if (onScreen == true && (prevDistance > (currentDistance + 0.01)))
                {
                    gameObject.GetComponent <RewardSender>().SendReward(-0.1f);
                }
                else if (onScreen == true && (prevDistance < (currentDistance - 0.01)))
                {
                    gameObject.GetComponent <RewardSender>().SendReward(-0.2f);
                }
                else
                {
                    gameObject.GetComponent <RewardSender>().SendReward(-0.4f);
                }
                prevDistance          = currentDistance;
                velSub.actionReceived = false;
                time = Time.time;
            }

            UpdateFeed();
            rosSocket.Publish(pub_id, img);
        }
Пример #6
0
 public void ThreadProc()
 {
     while (true)
     {
         rosSocket.Publish(publicationId, message);
         Thread.Sleep(10);
     }
 }
Пример #7
0
        public void Publish(Texture2D texture2D)
        {
            // Build up the message and publish
            message.header.frame_id = frameId;
            message.header.seq      = sequenceId;
            message.format          = "jpeg";
            message.data            = texture2D.EncodeToJPG(qualityLevel);
            rosSocket.Publish(publicationId, message);

            ++sequenceId;
        }
 // Use this for initialization
 void Start()
 {
     displayMessages = new Dictionary <string, float>();
     red             = new Color(1f, 0f, 0f, 0.5f);
     blue            = new Color(0f, 0f, 1f, 0.5f);
     offRed          = new Color(1f, 0f, 0.3f, 0.5f);
     offBlue         = new Color(0.3f, 0f, 1f, 0.5f);
     print("Starting ROSBRIDGE and ROSSHARP!");
     rosSocket = GetComponent <RosConnector>().RosSocket;
     rosSocket.Subscribe(agent_topic, "gameworld_simulation/Agent", agentSubscriber, UpdateTime);
     rosSocket.Subscribe(construction_task_topic, "gameworld_simulation/ConstructionTask", constuctionTaskSubscriber, UpdateTime);
     rosSocket.Subscribe(transport_task_topic, "gameworld_simulation/TransportTask", transportationTaskSubscriber, UpdateTime);
     rosSocket.Subscribe(ros_update_message_topic, "std_msgs/String", updateMessageSubscriber, UpdateTime);
     updateID     = rosSocket.Advertise(game_update_topic, "std_msgs/String");
     inputID      = rosSocket.Advertise(user_input_topic, "std_msgs/String");
     message.data = "start";
     rosSocket.Publish(updateID, message);
     lineMaterial = Resources.Load("Material/tile_ceilingPanel_fx", typeof(Material)) as Material;
 }
        public void Publish(Vector3 vector3)
        {
            // Build up the message and publish
            //message.header.frame_id = frameId;
            //message.header.seq = sequenceId;
            //é da capire in quale ordine va passato xyz

            /*
             * message.x = 1;
             * message.y = 0;   // z in ROS
             * message.z = 0 ;  //x in ROS
             */
            message.x = -vector3.y;
            message.y = vector3.z;
            message.z = vector3.x;
            Debug.Log(message);
            rosSocket.Publish(publicationId, message);

            //++sequenceId;
        }
Пример #10
0
 protected void Publish(object sender, MessageEventArgs e)
 {
     MessageProvider.MessageRealease -= Publish;
     rosSocket.Publish(publicationId, e.Message);
 }
Пример #11
0
 public void PublishMove()
 {
     Debug.Log("Sending execute message");
     rosSocket.Publish(executePublicationId, new StandardString());
 }
Пример #12
0
 public void SendGoal()
 {
     rosSocket.Publish(GoalPublicationId, GetGoal());
 }
Пример #13
0
 public void SendGoal()
 {
     socket.Publish(goalPublicationID, action.action_goal);
 }
Пример #14
0
 public void PublishPlan(MoveitTarget moveitTarget)
 {
     rosSocket.Publish(planPublicationId, moveitTarget);
 }
Пример #15
0
 public void SendReward(float r)
 {
     msg.data = r.ToString();
     rosSocket.Publish(pub_id, msg);
 }