To tackle the challenge posed by an obstructed middle joint in the robotic arm, we introduce a novel approach to solving the inverse kinematic problem within the obstacle space. This method seamlessly integrates collision detection with a genetic algorithm. First, the process begins with a thorough kinematic analysis of a seven-degree-of-freedom robotic arm, employing the Denavit-Hartenberg (D-H) parameter method. For collision detection, we streamline the process by utilizing an enclosing box model to simplify the collision function. Next, leveraging a standard genetic algorithm, we guide the initial population generation within the search space using Gaussian functions. Simultaneously, we construct an adaptive degree function that incorporates both the collision function and the positional error function. This fusion enables us to efficiently pinpoint the optimal inverse kinematic solution while ensuring collision-free movement within the obstacle-laden environment. Finally, the effectiveness and superiority of the proposed method are verified by MATLAB and Sawyer robotic arm.