Trajectory planning in the field of mobile robotics involves the generation of a trajectory to navigate a robot from a start state to a goal state. One widely employed technique involves a twostep approach: a path planner generates a path made up of piecewise linear segments with sharp turns, which are then smoothed in the trajectory generation step. In contrast, this work formulates trajectory generation as an optimization problem based on the Bézier curve, denoted as 'BTP', to generate the robot's trajectory in one step. It uses a weighted objective function to adopt different optimization strategies, while considering the robot kinematics and dynamics limitations. BTP adopts matrix-based formulations for all mathematical operations to enable dynamic adjustment of the degree of the Bézier curve during the optimization process, if convergence is not obtained with the current degree. Additionally, BTP guarantees that the robot's trajectory is always within the open space identified by the robot's sensors. The efficacy of BTP has been evaluated through simulations and real-world experimentation using different scenarios and objective functions. Finally, the performance is benchmarked against some of the existing trajectory planners.