예제 #1
0
        private void onDeliveryMove(string strmissionid, int actidx)
        {
            if (Data.Instance.isConnected)
            {
                try
                {
                    string   strRobot_id = cboRobotID.SelectedItem.ToString();
                    WAS_GOAL work_data   = onMissionDataRead(strmissionid, actidx);
                    string   strobj      = JsonConvert.SerializeObject(work_data);
                    JObject  obj         = JObject.Parse(strobj);

                    TopicList    list = new TopicList();
                    rosinterface ros  = new rosinterface();

                    Thread.Sleep(500);

                    ros.PublisherTopicMsgtype(strRobot_id + list.topic_goal, list.msg_goal);
                    Thread.Sleep(200);
                    ros.publisher(obj);
                    Thread.Sleep(200);
                }
                catch (Exception ex)
                {
                    Console.Out.WriteLine("onDeliveryMove err :={0}", ex.Message.ToString());
                }
            }
            else
            {
                MessageBox.Show("서버에 연결하세요.");
            }
        }
예제 #2
0
        private void btnLiftSet_Click(object sender, EventArgs e)
        {
            try
            {
                if (Data.Instance.isConnected)
                {
                    string strrobotid = "";
                    strrobotid = cboliftrobotID.SelectedItem.ToString();

                    int nlift = cboRobot_lift.SelectedIndex;

                    LiftStatus_Set_Arg lift = new LiftStatus_Set_Arg();

                    if (nlift == 0)
                    {
                        lift.data = 2;
                    }
                    else if (nlift == 1)
                    {
                        lift.data = -2;
                    }
                    string  strobj = JsonConvert.SerializeObject(lift);
                    JObject obj    = JObject.Parse(strobj);

                    rosinterface ros = new rosinterface();

                    TopicList list = new TopicList();
                    ros.PublisherTopicMsgtype(string.Format("{0}", strrobotid) + list.topic_set_liftstatus, list.msg_set_liftstatus);
                    Thread.Sleep(100);
                    ros.publisher(obj);
                    Thread.Sleep(100);
                }
            }
            catch (Exception ex)
            {
                Console.Out.WriteLine("btnLiftSet_Click err :={0}", ex.Message.ToString());
            }
        }