In a human-robot interaction system, the most important thing to consider is the safety of the user. This must be guaranteed in order to implement a reliable system. The main objective of this paper is to generate a safe motion scheme that takes into account the obstacles present in a virtual reality (VR) environment. The work is developed using the MoveIt software in ROS to control an industrial robot UR5. Thanks to this, we will be able to set up the planning group, which is realised by the UR5 robot with a 6-sided prop and the base of the manipulator, in order to plan feasible trajectories that it will be able to execute in the environment. The latter is based on the interior of a vehicle, containing a user (which would be the user in this case) for which the configuration will also be made to be taken into account in the system. To do this, we first investigated the software's capabilities and options for path planning, as well as the different ways to execute the movements. We also compared the different trajectory planning algorithms that the software is capable of using in order to determine which one is best suited for the task. Finally, we proposed different mobility schemes to be executed by the robot depending on the situation it is facing. The first one is used when the robot has to plan trajectories in a safe space, where the only obstacle to avoid is the user's workspace. The second one is used when the robot has to interact with the user, where a mannequin model represents the user's position as a function of time, which is the one to be avoided.