コード例 #1
0
 public NavControllerOutput(MavLinkMessage message) : base(null)
 {
     if (message.messid.Equals(this.MessageID))
     {
         MAVLink.mavlink_nav_controller_output_t data = (MAVLink.mavlink_nav_controller_output_t)message.data_struct;
         this.alt_error      = data.alt_error;
         this.aspd_error     = data.aspd_error;
         this.nav_bearing    = data.nav_bearing;
         this.nav_pitch      = data.nav_pitch;
         this.nav_roll       = data.nav_roll;
         this.xtrack_error   = data.xtrack_error;
         this.wp_dist        = data.wp_dist;
         this.target_bearing = data.target_bearing;
     }
 }
コード例 #2
0
        public void CheckNavControllerOutput()
        {
            MAVLink.mavlink_nav_controller_output_t data = new MAVLink.mavlink_nav_controller_output_t();
            data.alt_error      = 1;
            data.aspd_error     = 2;
            data.nav_bearing    = 2;
            data.nav_pitch      = 3;
            data.nav_roll       = 4;
            data.target_bearing = 5;
            data.wp_dist        = 6;
            data.xtrack_error   = 7;

            MavLinkMessage message = createSampleMessage(MAVLink.MAVLINK_MSG_ID.NAV_CONTROLLER_OUTPUT, data);

            NavControllerOutput obj = new NavControllerOutput(message);

            Assert.AreEqual(data.alt_error, obj.alt_error);
            Assert.AreEqual(data.aspd_error, obj.aspd_error);
            Assert.AreEqual(data.nav_bearing, obj.nav_bearing);
            Assert.AreEqual(data.nav_pitch, obj.nav_pitch);
            Assert.AreEqual(data.nav_roll, obj.nav_roll);
            Assert.AreEqual(data.target_bearing, obj.target_bearing);
            Assert.AreEqual(data.wp_dist, obj.wp_dist);
            Assert.AreEqual(data.xtrack_error, obj.xtrack_error);

            NavControllerOutputDTO dto = DTOFactory.createNavControllerOutputDTO(obj);

            Assert.AreEqual(dto.alt_error, obj.alt_error);
            Assert.AreEqual(dto.aspd_error, obj.aspd_error);
            Assert.AreEqual(dto.nav_bearing, obj.nav_bearing);
            Assert.AreEqual(dto.nav_pitch, obj.nav_pitch);
            Assert.AreEqual(dto.nav_roll, obj.nav_roll);
            Assert.AreEqual(dto.target_bearing, obj.target_bearing);
            Assert.AreEqual(dto.wp_dist, obj.wp_dist);
            Assert.AreEqual(dto.xtrack_error, obj.xtrack_error);
        }