# Trajectory Planning for a Mobile Robot in a Dynamic Environment Using an LSTM Neural Network
## 5 Conclusions  
An environment with the mobile robot, and multiple static obstacles and a dynamic obstacle located in different positions within the same occupancy grid map was computationally simulated. LiDAR scan values obtained every two degrees within a laser scan sample from 0 to 180\({}^{\circ}\) at the front of the robot were considered. The training examples were obtained by operating the mobile robot in a known dynamic environment and recording and labeling its sensor readings, target desired location, mobile robot location with respect to its odometry reference frame, and the velocity readings. Finally, an Adam optimization method for the LSTM model was created and trained with several examples of trajectories composed of the velocity commands given by the user, with six different target points, three distinct dynamic obstacles behaviors, and three unalike initial conditions for the mobile robot. Results showed an accuracy of training of above 99%. An MSE of 0.0002 \(m/s\) for the linear velocity in \(x\), and an MSE of 0.0004 \(rad/s\) for the angular velocity in \(z\) of \(tb3\_0\) were obtained. In other words, an error of \(\approx\) 0.1466% for the linear velocity in \(x\) was obtained, considering an average human-driver linear velocity of 0.1364 \(m/s\), and an error of \(\approx\) 4.9535% for the angular velocity in \(z\) was obtained, considering an average human-driver angular velocity of \(-\)0.0081 \(rad/s\).  
With shorter trajectories \((<2\) m) the model can generalize other trajectories for which it was not specifically trained; however, it must be within a 15 cm radius of a trained destination position. In the case of longer and more complex trajectories the mobile robot can successfully arrive at the destination point for which the model was trained. The LSTM network with an Adam optimization method allows a robot to find a trajectory from the specified start location to the desired location while avoiding dynamic and static obstacles.  
In the future, the method proposed may be applied for more complex tasks such as: planning trajectories for a group of mobile robots; testing by changing the velocity and path of the dynamic obstacle; adding more dynamic obstacles; and considering more training example trajectories composed of the velocity commands given by the user to strengthen the model. Furthermore, physical experiments with the TurtleBot 3 Waffle Pi could be executed to validate the model.  
Conceptualization, A.M.-L., A.G.-E. and J.A.E.C.; methodology, A.M.-L., A.G.-E. and J.A.E.C.; software, A.M.-L. and J.A.E.C.; validation, A.M.-L., A.G.-E., J.A.E.C., E.C.-U. and S.R.C.-R; formal analysis, A.M.-L. and A.G.-E.; investigation, A.M.-L.; resources, J.A.E.C.; data curation, A.M.-L.; writing--original draft preparation, A.M.-L.; writing--review and editing, A.M.-L., A.G.-E., J.A.E.C., E.C.-U. and S.R.C.-R.; visualization, A.M.-L.; supervision, A.G.-E. and J.A.E.C.; project administration, A.M.-L. and A.G.-E.; funding acquisition, J.A.E.C. All authors have read and agreed to the published version of the manuscript.  
This research received no external funding.  
Not applicable.  
Authors would like to acknowledge the support of Tecnologico de Monterrey, and the financial support from CONACyT for MSc studies of the first author.  
The authors declare no conflict of interest.