Week 6
Now that we had web sockets set up for both the map and the robot it was time to combine the two so that we could have the robot actually move around in the map. We used two separate web sockets for this which we had running at the same time. To make this work in the frontend I had to create a function which would distinguish what message was sent from the backend, either a map or a velocity command, and execute that command. I created two socket.onmessage methods which both called a handleMessage function. That handleMessage function then distinguished what message was sent trough the WebSocket with an if-statement and the right commands were executed. I also worked on a software diagram which showed how the backend and frontend were interacting together. We will be making changes and additions to this diagram as we continue adding more functions to the robot. We are also discussing using LCM instead of multiple websockets, since that would make it easier to combine multiple functions in the same simulation.