Enable remote operation of the rover by creating Protobuf messages and handlers for the major drive functions.
Create a new .proto file in src/network/rover_system_messages. Add a line in CMakeLists.txt to generate the protobuf file, and register the new types in rover_system_messages.hpp. Define the required message formats in the proto file. The number assigned to each field is an ID for that field and can be assigned sequentially (see video_control.proto)
In the subsystem program, include rover_system_messages.hpp and call the register types function.
In the subsystem program, open a net::MessageReceiver on port 22101. You'll also have to define a Boost IO context before constructing the receiver. Also open the receiver before the main loop. Poll the IO context in the main loop.
Before the main loop, register handlers for the new message types.
Additional safety feature: in the drive controller, call halt() if there has been no activity in over 1 second. You can use std::chrono to save a timepoint for last activity. In the update acceleration function that's called every loop, compare the timepoint with the current time
Testing Advice
You can create a separate executable (or put it right in subsystem) with a net::MessageSender that sends messages to IP 127.0.0.1 (universal name for "this device" or "localhost") and port 22101.
Requirements
Enable remote operation of the rover by creating Protobuf messages and handlers for the major drive functions.
.proto
file insrc/network/rover_system_messages
. Add a line in CMakeLists.txt to generate the protobuf file, and register the new types inrover_system_messages.hpp
. Define the required message formats in the proto file. The number assigned to each field is an ID for that field and can be assigned sequentially (see video_control.proto)rover_system_messages.hpp
and call the register types function.net::MessageReceiver
on port 22101. You'll also have to define a Boost IO context before constructing the receiver. Also open the receiver before the main loop. Poll the IO context in the main loop.halt()
if there has been no activity in over 1 second. You can usestd::chrono
to save a timepoint for last activity. In the update acceleration function that's called every loop, compare the timepoint with the current timeTesting Advice
You can create a separate executable (or put it right in subsystem) with a
net::MessageSender
that sends messages to IP 127.0.0.1 (universal name for "this device" or "localhost") and port 22101.Timeline
Pull request by end of syllabus week?
Resources