|
bitsim
Model, simulate, estimate and control robots in C++
|
What a participant of a distributed simulation sends: the state of its bodies at one step, or that it leaves. More...
#include <state_message.h>
Public Types | |
| enum class | Kind : uint_t { STATE = 0 , LEAVE = 1 } |
Public Member Functions | |
| std::string | encode () const |
| The message in MessagePack, for a transport. | |
Static Public Member Functions | |
| static StateMessage | decode (const std::string &bytes) |
| Read a message that encode() wrote. | |
Public Attributes | |
| Kind | kind {Kind::STATE} |
| std::string | participant |
| uint_t | step {0} |
| real_t | time {0.0} |
| real_t | stamp {0.0} |
| std::vector< BodyState > | bodies |
| std::vector< real_t > | values |
What a participant of a distributed simulation sends: the state of its bodies at one step, or that it leaves.
time is the simulated time of the step; stamp is the wall-clock time it was sent, in seconds since the epoch of std::chrono::system_clock, which a participant in wall-clock mode uses to tell how old the state is. Across machines that needs their clocks in step, with NTP for example.
values carries numbers that are not bodies: the action of an agent whose world every participant simulates, for one, or anything else the participants agree on.
|
strong |
|
static |
Read a message that encode() wrote.
| std::invalid_argument | if bytes is not one |
| std::string bitsim::distributed::StateMessage::encode | ( | ) | const |
The message in MessagePack, for a transport.
| std::vector<BodyState> bitsim::distributed::StateMessage::bodies |
| Kind bitsim::distributed::StateMessage::kind {Kind::STATE} |
| std::string bitsim::distributed::StateMessage::participant |
| real_t bitsim::distributed::StateMessage::stamp {0.0} |
| uint_t bitsim::distributed::StateMessage::step {0} |
| real_t bitsim::distributed::StateMessage::time {0.0} |
| std::vector<real_t> bitsim::distributed::StateMessage::values |