When running my custom_trajectory function, I try to move the robot straight first by calling the move_forward function and then try to make it turn using the turn function call, but the robot seems to be getting stuck after moving just a little (it's not hitting the wall).
This is unlikely to be a bug, but some gaps in your code or knowledge. It might as well be the way the code was designed to work.
If you could record a short screencast showing this problem, with every part shown (code, sim window, output on the web shell), we can see if there’s any problem.
If not, I would say that you should not worry too much about this now, as the goal of this course is to learn C++, not ROS. You will learn ROS better when you take the ROS basics courses.