X-Plane Commands and Datarefs TCP vs. UDP

Slides:



Advertisements
Similar presentations
How to Convert Decimal Numbers to Binary EXAMPLES.
Advertisements

Umut Girit  One of the core members of the Internet Protocol Suite, the set of network protocols used for the Internet. With UDP, computer.
TFTP (Trivial File Transfer Protocol)
Craig Schock, 2003 Binary Numbers Numbering Systems Counting Symbolic Bases Common Bases (10, 2, 8, 16) Representing Information Binary to Decimal Conversions.
Computer Systems 1 Fundamentals of Computing
 Binary Binary  Binary Number System Binary Number System  Binary to Decimal Binary to Decimal  Decimal to Binary Decimal to Binary  Octal and Hexadecimal.
+ CS 325: CS Hardware and Software Organization and Architecture Integers and Arithmetic.
Converting binary to decimal decimal to binary
Revision Introductory Lesson
1 Data Representation Computer Organization Prof. H. Yoon DATA REPRESENTATION Data Types Complements Fixed Point Representations Floating Point Representations.
The character data type char
Computers Organization & Assembly Language
Digital Design: From Gates to Intelligent Machines
Decimal Binary Octal Hex
Dept. of Computer Science Engineering Islamic Azad University of Mashhad 1 DATA REPRESENTATION Dept. of Computer Science Engineering Islamic Azad University.
EX_01.1/46 Numeric Systems. EX_01.2/46 Overview Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code,
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
Binary, Decimal and Hexadecimal Numbers Svetlin Nakov Telerik Corporation
10-Sep Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Sept Representing Information in Computers:  numbers: counting numbers,
HOW COMPUTERS MANIPULATE DATA Chapter 1 Coming up: Analog vs. Digital.
Data Representation Conversion 24/04/2017.
DECIMALBINARY a) b) c) d) e) f) Revision Exercise DECIMALBINARY a) b) c)
1 Information Representation in Computer Lecture Nine.
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
CS 2130 Lecture 23 Data Types.
Systems Architecture, Fourth Edition 1 Data Representation Chapter 3.
Hexadecimal (base 16) BY MAT D. What is hexadecimal  Hexadecimal is a number system like binary or denary that has 16 characters, the numbers 0-9 and.
Programming for GCSE Topic 2.2: Binary Representation T eaching L ondon C omputing William Marsh School of Electronic Engineering and Computer Science.
The Hexadecimal System is base 16. It is a shorthand method for representing the 8-bit bytes that are stored in the computer system. This system was chosen.
PRIMITIVE TYPES IN JAVA Primitive Types Operations on Primitive Types.
Data Representation COE 308 Computer Architecture
Computer Science 210 Computer Organization
Bits, Data Types, and Operations
Chapter 2 Bits, Data Types, and Operations
Machine level representation of data Character representation
Chapter 3 Data Representation Text Characters
NUMBER SYSTEMS.
Data Representation ICS 233
Lec 3: Data Representation
Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
Data Representation.
DATA REPRESENTATION Data Types Complements Fixed Point Representations
Data Representation Binary Numbers Binary Addition
ECE Application Programming
Chapter 2 Data Types and Representations
Layered Architectures
Process-to-Process Delivery
Slide design: Dr. Mark L. Hornick
Location in course textbook
ECE 103 Engineering Programming Chapter 3 Numbers
Binary, Decimal and Hexadecimal Numbers
Javascript, Loops, and Encryption
as presented on that date, with special formatting removed
Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
Slide design: Dr. Mark L. Hornick
ASCII Character Codes nul soh stx etx eot 1 lf vt ff cr so
Data Representation Conversion 05/12/2018.
Transport Protocols An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
DATA REPRESENTATION Data Types Complements Fixed Point Representations
Cosc 2P12 Week 2.
Number Systems Lecture 2.
Introduction to Computer Engineering
DATA REPRESENTATION Data Types Complements Fixed Point Representations
DATA REPRESENTATION Data Types Complements Fixed Point Representations
Cosc 2P12 Week 2.
Transport Layer 9/22/2019.
Data Representation COE 308 Computer Architecture
Review: Last Presentation
Chapter 2 Bits, Data Types, and Operations
Presentation transcript:

www.PeninsulaSims.com ryan@peninsulasims.com 06.12.2019

X-Plane Commands and Datarefs TCP vs. UDP

UDP Native X-Plane Format Exercise: Turning on the night vision “Easy!” (not, at least it wasn’t for me)

TCP vs. UDP Transmission Control Protocol Reliable, message acknowledgment, handshaking Ordered Heavyweight Streaming User Datagram Protocol Unreliable, no acknowledgment or handshake Lightweight No congestion control Connectionless Multicast Native X-Plane

ExtPlane (TCP) vs. X-Plane UDP UDP Format requires tracking length of packet and padding out to 509 bytes UDP Format makes use of IEEE Float for values being sent, which is complicated to convert (for novices) TCP via ExtPlane is simple and intuitive TCP does not require conversion to IEEE Float (someone has already done that) TCP does not require understanding the underlying packet TCP reply received with each command sent

Laminar’s Instructions for UDP

Set a Dataref to a Value

Let’s turn on the night vision! Dataref needs to be set to 1: Dataref: sim/cockpit/electrical/night_vision_on IEEE Float value of 1 (4 byte byte value), LSB First Hex representation of an ASCII space, and how to pad out to 509 bytes Hex representation of an ASCII 0 (zero) Syntax: DREF0+(4byte byte value of 1)+ sim/cockpit/switches/anti_ice_surf_heat_left+0+ spaces to complete to 509 bytes

IEEE Float IEEE Floating Point Converter https://www.h- schmidt.net/FloatConverter/IEEE754.html Your Value: 1 (e.g., dataref set to “1” or “on”) Hex representation: 0x3f800000 4-byte byte value: 3F 80 00 00 Least significant bit first: 00 00 80 3F

ASCII Character Table Dec Char Dec Char Dec Char Dec Char --------- --------- --------- ---------- 0 NUL (null) 32 SPACE 64 @ 96 ` 1 SOH (start of heading) 33 ! 65 A 97 a 2 STX (start of text) 34 " 66 B 98 b 3 ETX (end of text) 35 # 67 C 99 c 4 EOT (end of transmission) 36 $ 68 D 100 d 5 ENQ (enquiry) 37 % 69 E 101 e 6 ACK (acknowledge) 38 & 70 F 102 f 7 BEL (bell) 39 ' 71 G 103 g 8 BS (backspace) 40 ( 72 H 104 h 9 TAB (horizontal tab) 41 ) 73 I 105 i 10 LF (NL line feed, new line) 42 * 74 J 106 j 11 VT (vertical tab) 43 + 75 K 107 k

Convert letters D R E F to Hex Step 1: Convert D to ASCII decimal value using table D = 68 R = 82 E = 69 F = 70

Convert Decimal to Hex: D/68 Divide by 16 until there is no remainder Read back remainders bottom to top 68 / 16 = 4 remainder 4 4 / 16 = 0 remainder 4 Result = 44 (remainders read bottom to top)

Why in the world Hex? Decimal (base 10): 10 fingers, 10 toes Inefficient: Decimal: 39,321 Hex: 9999 Binary 1001 1001 1001 1001 (bits are ones and zeroes) Hexadecimal (base 16) Natural complement to binary data One hexadecimal value can store 4 pieces of data (e.g., 0101) Good for compression

Convert Decimal to Hex: R/82 Divide by 16 until there is no remainder 82 / 16 = 5 remainder 2 5 / 16 = 0 remainder 5 Result = 52

Convert letters D R E F to Hex Step 1: Convert ASCII decimal value using tabulated values Step 2: Convert decimal to hex (base 10 to base 16) MSB first D = 68 = 44 R = 82 = 52 E = 69 = 45 F = 70 = 46

Set DREF Night Vision On DREF0+(4byte byte value)+dref_path+0+spaces to complete the whole message to 509 bytes DREF\00\00\00\80\3Fsim/cockpit/electrical/night_visi on_on\00 44 52 45 46 00 00 00 80 3f 73 69 6d 2f 63 6f 63 6b 70 69 74 2f 65 6c 65 63 74 72 69 63 61 6c 2f 6e 69 67 68 74 5f 76 69 73 69 6f 6e 5f 6f 6e 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20

Packet sent via UDP 44 52 45 46 00 00 00 80 3f 73 69 6d 2f 63 6f 63 6b 70 69 74 2f 65 6c 65 63 74 72 69 63 61 6c 2f 6e 69 67 68 74 5f 76 69 73 69 6f 6e 5f 6f 6e 00 20 20 20 20 20 20 D R E F 0 1 S I M / c o c k p i t / e l e c t r i c a l / n i g h t _ v i s i o n _ o n 0 sp sp sp sp sp sp sp sp sp sp sp sp sp … ( until 509 bytes total)

Send in packet to port 49000 Night vision turns on 44 52 45 46 00 00 00 80 3f 73 69 6d 2f 63 6f 63 6b 70 69 74 2f 65 6c 65 63 74 72 69 63 61 6c 2f 6e 69 67 68 74 5f 76 69 73 69 6f 6e 5f 6f 6e 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20

Why is this important? Understanding the UDP syntax enables me to send commands to X-Plane without the ExtPlane plugin. Plugins can cause simulator instability or crashes. The downside is the difficulty in setting datarefs, e.g., course (0 to 359 degrees). IEEE Float

Demonstration Packet Sender Example

Via ExtPlane...Stay Tuned! TCP Via ExtPlane...Stay Tuned!

www.PeninsulaSims.com ryan@peninsulasims.com 06.12.2019