The two-wheeled robotic machine (TWRM) with five degrees of freedom (DOF) is a type of mobile robot that consists of two wheels and a body that can rotate and move in different directions. The proposed architecture of the TWRM in this paper features five DOFs, which allows for greater flexibility and range of motion. However, this also makes controlling the system more challenging, as thecenter of mass (COM) changes while performing tasks in multiple directions. To address this issue, the study utilizes a state-space model created by linearizing the non-linear modeling equations at the equilibrium point using the Lagrangian modeling. To stabilize the TWRM, several controllers were evaluated, including PID, LQR, and LQR with PID methods. The PID controller is a popular feedbackcontrol strategy that adjusts the control output based on the error between the desired and actual values of the systemoutput. LQR is a state-space control technique that aims to minimize a cost function that expresses the system's performance criteria. The PID with LQR technique combines the strengths of both strategies, with PID used as a feed-forward to control the intermediate body (IB) and end-effector and LQR used as state feedback to regulate all states. The controllers were evaluated under variouscircumstances, including disturbance signals, trackingpathways, and moving actuators. Simulation results showedthat the LQR with LQR controller performed better thanthe other two control systems in terms of least overshoot,rising time, and applied input forces. This suggests that thePID with LQR technique is a robust and effective controlstrategy for stabilizing the TWRM and improving itsperformance for various tasks.