Message Routes
Projects Involved: OBC, GCS
Concepts: Post requests, Protobuf in OBC
Abstract:
The final step of this onboarding project is for you to write a route /message
that handles POST requests from the GCS. Unlike a GET request (like /capture
), which only attempts to fetch some information from the OBC, a POST request attempts to send some information to the OBC. In this case, that information is the matched target from the dropdown menu from the previous step. This information is serialized to json in the GCS, and then deserialized back to a proto message in the OBC. You will be using this information to make sure that the object matched is what is shown in the displayed image.
Goals:
- Learn to write and route post requests
- Learn to serialize and deserialize proto messages
Files Involved:
OBC
include/network/gcs_routes.hpp
src/network/gcs_routes.cpp
src/network/gcs.cpp
GCS
backend-go/internal/obc/client.go
backend-go/internal/server/server.go
Base Steps:
1. Uncomment the imports at the top of client.go
and server.go
, and uncomment the methods used for the message handler in both of the files.
2. Fix the appropriate handlers for POST /message
in client.go
and server.go
on the GCS side.
- For
client.go
, you should just read the TODO comments to see what needs to be implemented. - For
server.go
, try to figure out what the vague TODO message does.
3. Add the route handler on the OBC side.
- To check if an "object" is correctly matched, you should just check if the detected object name from the route is the same as the image filename (this information should already be stored within the mission state
image
variable). No need to check for capitalization or different spellings or anything of that matter.