Safe and secure operations of robotic systems are of paramount importance. Aiming for achieving the trusted operation of a military robotic vehicle under contested environments, we introduce a new cyber-physical system based on the concepts of deep learning convolutional neural networks (CNNs). The proposed algorithm is specifically designed to reduce the cyber vulnerability of the Robot Operating System (ROS), a well-known middleware platform widely used in both civilian and military robots. To demonstrate the efficacy of the proposed algorithm, we conduct penetration testing (real-time man-in-the-middle cyberattacks) on the GVR-BOT Unmanned Ground Vehicle (UGV), a military ground robot, developed by the United States Army Combat Capabilities Development Command (CCDC), Ground Vehicle Systems Center. The cyberattacks also exploit the vulnerability of the Robot Operating System (ROS) employed in its onboard computer. We collect experimental data and train our CNN based on two different operating conditions, namely, legitimate and malicious. We normalize and convert the network traffic data in the form of RGB or grayscale images. We introduce two different types of windowing techniques, namely, the independent and overlapping sliding epochs to efficiently feed the network traffic data to our CNN system. Our research indicates the efficacy of the proposed algorithm as our proposed cyber intrusion detection system can achieve reasonably high accuracies ≥ 99 % and substantially small false-positive rates ≤ 2 % supported with minimum detection times. In addition, we also compare and demonstrate the relative merits of our proposed algorithm with respect to the performance of some well-known techniques, namely, 'bag-of-features' and Support Vector Machine (SVM) algorithms.