Thin gap chambers (TGCs) is the end-cap muon trigger detector of the ATLAS experiment, one of the major projects being built at CERN, Geneva, Switzerland. The TGC detector will be inaccessible during operation due to high radiation levels in the ATLAS cavern. The detector requires a detector-control system (DCS) to monitor important detector and environmental parameters, calibrate, set, and maintain the configuration of front-end electronics, and take appropriate corrective action to maintain the detector stability and reliable performance. The TGC DCS is a distributed system, comprising a central control and configuration master station, and about 1500 microcontroller slaves connected to it using a controller area network (CAN). The CAN nodes control hardware devices such as the thresholds for amplifier shaper discriminators (ASDs), and data-acquisition parameters. CAN nodes are distributed on the on-chamber trigger electronic boards, to service many channels close to their source. In contrast to many other control systems, the TGC DCS makes full use of the intelligence offered by the ATLAS ELMB CAN nodes, in order to distribute the control of complex tasks on the front-end nodes and reduce CAN bus traffic. These nodes implement JTAG and I2C protocols, monitor hardware parameters, generate test patterns, and histogram chamber charge for diagnostics. The hardware and software design, integration, performance, and radiation test results are described.