Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: PSL_ROBOT_lorenzo robot_lorenzo recepteur_mbed_os_6
Diff: MX12.h
- Revision:
- 3:add8b050eb86
- Parent:
- 2:02f3323a107d
- Child:
- 4:277e5a4cba2e
--- a/MX12.h Thu Nov 04 06:12:21 2021 +0000 +++ b/MX12.h Thu Nov 04 07:21:32 2021 +0000 @@ -46,28 +46,30 @@ { public: - /** Status enum, possible status of servomotor + /** Error status occurred during the operation of servomotor. * + * BDenis remarj: enum type is not suitable for the errors status + * because several errors can be repported simultaneously */ enum Status { - InstructionError, ///< - OverloadError, - ChecksumError, - RangeError, - OverheatingError, - AngleLimitError, - InputVoltageError, - Unknown, - Ok + InstructionError, ///< In case of sending an undefined instruction or delivering the action instruction without the Reg Write instruction + OverloadError, ///< When the current load cannot be controlled by the set Torque + ChecksumError, ///< When the Checksum of the transmitted Instruction Packet is incorrect + RangeError, ///< When an instruction is out of the range for use + OverheatingError, ///< When internal temperature of servomotor is out of the range of operating temperature set in the Control table + AngleLimitError, ///< When Goal Position is written out of the range from CW Angle Limit to CCW Angle Limit + InputVoltageError, ///< When the applied voltage is out of the range of operating voltage set in the Control table + Unknown, ///< ??? + Ok ///< no error }; /** State enum, possible state of communication automaton * */ enum State { - ReadingPosition, - Writing, - Available, + ReadingPosition, ///< ReadingPosition + Writing, ///< Writing + Available, ///< Available }; /** Create MX12 instance @@ -112,9 +114,21 @@ * of a servomotor MX12 (https://emanual.robotis.com/docs/en/dxl/mx/mx-12w/#control-table-of-ram-area). * @param[in] len if it is a write instruction, size in bytes * of the data to write in the "Control Table of RAM Area" - * @param[in] data array of char containing parameter of Danamixel + * @param[in, out] data array of char containing parameter of Danamixel * protocol that are the instruction’s auxiliary data field * + * @see https://emanual.robotis.com/docs/en/dxl/protocol1/ + * + * Packet sent + * + * |Header1|Header2|Packet ID|Length|Instruction|Param1...ParamN|Checksum | + * |-------|-------|---------|------|-----------|---------------|---------| + * | 0xFF | 0xFF |Packet ID|Length|Instruction|Param1...ParamN| CHKSUM | + * | cmd[0]| cmd[1]| cmd[2] |cmd[3]| cmd[4] |cmd[5]... |(2 bytes)| + * \_ _/ \__ __/ + * \/ \/ + * address data + * (len = N-1) */ void rw(unsigned char mot_id, char address, char len, char *data);