Trees | Indices | Help |
---|
|
( concrete ) DESCRIPTION: -- The Bus class serves as an interface between the dynamixel RS485 bus and Protocol RESPONSIBILITIES: -- intialize a serial newConnection at the desired baudrate. default: 1000000 -- format packets into dynamixel understanble messages -- write packets -- read in valid packets, throw out others - maintain error counts from read attempts -- provide syncronous write then read capability OWNERSHIP: -- owned by the dynamixel module THEORY: -- builds and writes Dynamixel EX packets as per EX-106 section 3-2 pp. 16 -- reads packets and parses for valid ones as per EX-106 section 3-3 pp. 17 CONSTRAINTS: -- requires valid baudrate setting for communication -- writes and reads limited by pyserial->termios
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
|
|||
|
|||
|
|
|||
|
|
|||
Inherited from |
|
Initialize Dynamixel Bus INPUT: port -- serial port string or None to autoconfig ATTRIBUTES: ser -- serial handle buf -- buffer string ' expect -- number of expected bytes. default: 6 eSync -- number of SYNC errors eChksum -- number of checksum errors eLen -- number of length errors eID -- number of ID errors count -- a count of bytes received rxPkts -- a count of valid packets received txPkts -- a count of packets sent
|
returns the current Bus statistics OUTPUTS: -- list -- strings indicating current counts, error, etc ... |
(private) Compute checksum as per EX-106 section 3-2 pp. 17 INPUTS: dat -- string -- data from which to compute checksum OUTPUTS: return -- int -- value of checksum between 0 and 0xFF THEORY OF OPERATION: Compute checksum using not bit operator for only the lowest byte of the sum |
(private) Parse and output error returned from dynamixel servos as per 3-4-1 pp. 25 |
Parses a message into human readable form INPUT: msg -- one or more message in a string OUTPUT: the messages in human-readable form |
reads a single packet off of the RS485 or serial bus INPUTS: None OUTPUTS: pkt -- string -- valid packet from Dynamixel hardware bus PRECONDITIONS: existence of serial object reset() has been called at least once POSTCONDITIONS: pkt is returned given that all values of packet check OUTPUTS THEORY OF OPERATION: Parse for valid packets as per EX-106 section 3-3 pp. 17 - While there are bytes to be read from serial buffer or from buf - Read in expected number of bytes if available - Check for start frame, otherwise drop byte - Check for valid ID, otherwise drop byte - Check for valid Length, otherwise drop byte - Once Length bytes arrive, check if CRC is valid, otherwise drop byte - If there are no more bytes to read or parse then return None |
Build a message and transmit, update rxPkts, and return message string INPUTS: nid -- int -- node ID of module cmd -- int -- command value. ie: CMD_PING, CMD_WRITE_DATA, etc ... pars -- string -- parameter string OUTPUTS: msg -- string -- transmitted packet minus sync PRECONDITIONS: existance of serial object POSTCONDITIONS: None THEORY OF OPERATION: Assemble packet as per EX-106 section 3-2 pp. 16, Compute checksum, transmit and then return string |
Build a SYNC_WRITE message writing a value INPUTS: nid -- int -- node ID of module addr -- string -- address pars -- string -- value (after marshalling) OUTPUTS: msg -- string -- transmitted packet minus sync PRECONDITIONS: existance of serial object POSTCONDITIONS: None THEORY OF OPERATION: Set a value remotely, without expecting a reply |
Send a low level ping command to a given nid INPUTS: nid -- int -- node ID of module OUTPUTS: None PRECONDITIONS: instantiation of dynamixel.Bus POSTCONDITIONS: No response occurs THEORY OF OPERATION: Send CMD_PING for given nid as per section 3-5-5 pp. 37 |
Send a low level reset command to a given nid INPUTS: nid -- int -- node ID of servo to reset THEORY OF OPERATION: Send CMD_RESET for given nid as per section 3-5-6 pp. 38 Resets all values in the servo's control table to factory defaults, INCLUDING the ID, which is reset to 0x01. By convention, we reserve ID 0x01 for configuration purposes |
Send a command in synchronous form, waiting for reply INPUTS: nid, cmd, pars -- same as for .send() timeout -- float-- maximal wait per retry retries -- number of allowed retries until giving up rate -- wait time between retries OUTPUTS: pkt -- string -- response packet's payload THEORY OF OPERATION: Plan out sending times for all retries. When a retry goal time is passed sends out the message. In between, poll for a reply for that message at a hard coded rate (currently 100Hz) |
Unpack reply header and payload OUTPUT: nid, len, cmd, tail nid -- node ID len -- message length cmd -- command code in message tail -- remainder of the message, as a string |
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Thu Jan 4 16:46:17 2018 | http://epydoc.sourceforge.net |