Download Autonomous UAV Final Report - Senior Design
Transcript
8.4.4 Appendix IV - PICstix Communications Protocol Overview The PICstix Communications Protocol, in the scope of our project, is used to define the serial communications between the Gumstix single-board computer and the 32-bit PIC microcontroller. The PIC is used for reading in IMU data and sonar data and outputting PWM signals used to drive motor controllers. The PIC can switch between autonomous and manual flight control modes. The Gumstix is responsible for assembling the data gathered from the environment and making macro control choices, i.e., move forward x distance. The Gumstix also uses a laser range finder to monitor obstacle proximity. The Gumstix can quickly halt platform movement via an interrupt request signal to the PIC. That signal is not part of the serial communications but will be discussed at the end of this document. Details The PICstix protocol is designed for 32-bit word communication between the two controllers. Each 32-bit word will be referred to as an instruction. Instructions use little endian format. The Gumstix is the host and the PIC is the slave device. Instructions come in two categories, host instructions (from the Gumstix to the PIC) and device instructions (from the PIC to the Gumstix). Instructions of both types use a 5-bit opcode, defined as the least significant bits of the instruction. The leading four bits are left at 0. In general, the remaining 23 bits are used to carry data. Lead Zeros 31 30 29 28 Data [27...5] Opcode 43210 Some of the data is sent in a signed fixed-point number format, with one sign bit, 12 bits for the whole part and 10 bits for the fractional part. signed fixed => 13bits.10bits Ex. 3.75 => 000000000011.110000000 The idea here is to eliminate the need for floating point data to be sent between host and device. Data with a whole part larger than 512 or a fractional part smaller than 0.1 is not expected, but clearly supported. Host Instructions All of the following instructions are sent from the Gumstix to the PIC. Flight Control – These instructions cause the PIC to adjust motor speeds and make the platform move. Horizontal Motion Opcodes: Forward – 01000 Backward – 01001 Strafe right – 01110 Strafe left – 01111 Lead Distance (signed fixed, cm) Opcode 55 | P a g e