Designing quality of service (QoS) guaranteed communication protocol for wireless sensor networks (WSNs) is essential to exploit the advantages and flexibilities offered by this technology for real-time control and actuation applications. A novel cross-layer protocol that embraces altogether a semi-random routing, MAC, data aggregation, and radio power control for clustered WSNs is presented. The protocol leverages the combination of a randomized and a deterministic approach to ensure robustness over unreliable channels and packet losses. An optimization problem, whose objective function is the network energy consumption, and the constraints are reliability and latency of the packets is modelled and solved to adaptively select the protocol parameters by a simple algorithm. As a relevant contribution, the proposed protocol is completely implemented on a test-bed, and it is compared to existing protocols. Experimental results validate the analysis and show excellent performance in terms of reliability, latency, low node duty cycle, load balancing and dynamic adaptation to the application requirements.