8 #include <gui_main_control_settings_t.hpp> 20 printf(
"[Simulation Driver] Starting main loop...\n");
33 "simulator and simulatorDriver don't agree on which robot we are " 34 "simulating (robot %d, sim %d)\n",
36 throw std::runtime_error(
"robot mismatch!");
56 printf(
"[Simulation Driver] Transitioned to exit mode\n");
60 throw std::runtime_error(
"unknown simulator mode");
79 "[SimulationBridge] Warning: the simulator has run a ControlParameter " 80 "iteration, but there is no new request!\n");
86 assert(nRequests == 1);
93 std::string name(request.
name);
98 throw std::runtime_error(
99 "type mismatch for parameter " + name +
", robot thinks it is " +
101 " but received a command to set it to " +
114 strcpy(response.
name,
118 printf(
"%s\n", response.
toString().c_str());
123 std::string name(request.
name);
125 printf(
"[Simulation Bridge] Warning: tried to set user parameter, but the robot does not have any!\n");
131 throw std::runtime_error(
132 "type mismatch for parameter " + name +
", robot thinks it is " +
134 " but received a command to set it to " +
148 strcpy(response.
name,
152 printf(
"%s\n", response.
toString().c_str());
157 std::string name(request.
name);
162 throw std::runtime_error(
163 "type mismatch for parameter " + name +
", robot thinks it is " +
165 " but received a command to set it to " +
174 strcpy(response.
name,
179 printf(
"%s\n", response.
toString().c_str());
182 throw std::runtime_error(
"unhandled get/set");
188 printf(
"[Simulator Driver] First run of robot controller...\n");
190 printf(
"\tAll %ld control parameters are initialized\n",
194 "\tbut not all control parameters were initialized. Missing:\n%s\n",
196 throw std::runtime_error(
197 "not all parameters initialized when going into RUN_CONTROLLER");
201 if(userControlParameters) {
202 if (userControlParameters->isFullyInitialized()) {
203 printf(
"\tAll %ld user parameters are initialized\n",
204 userControlParameters->collection._map.size());
208 "\tbut not all control parameters were initialized. Missing:\n%s\n",
209 userControlParameters->generateUnitializedList().c_str());
210 throw std::runtime_error(
211 "not all parameters initialized when going into RUN_CONTROLLER");
243 printf(
"[run_sbus] starting...\n");
ControlParameterRequestKind requestKind
TiBoardData * tiBoardData
ControlParameterCollection collection
ControlParameterValueKind _kind
ControlParameterValueKind parameterKind
ControlParameters * _userParams
std::string controlParameterValueKindToString(ControlParameterValueKind valueKind)
std::map< std::string, ControlParameter * > _map
ControlParameterValue value
VectorNavData * vectorNavData
std::thread * sbus_thread
bool isFullyInitialized()
ControlParameterRequestKind requestKind
TiBoardCommand * tiBoardCommand
void handleControlParameters()
void attach(const std::string &name)
char name[CONTROL_PARAMETER_MAXIMUM_NAME_LENGTH]
void set(ControlParameterValue value, ControlParameterValueKind kind)
ControlParameterValueKind parameterKind
#define DEVELOPMENT_SIMULATOR_SHARED_MEMORY_NAME
void sbus_packet_complete()
Function which handles the completion of an SBUS Packet and overrides the LCM control settings as des...
GamepadCommand * driverCommand
CheetahVisualization * cheetahMainVisualization
int init_sbus(int is_simulator)
ControlParameter & lookup(const std::string &name)
ControlParameterValue get(ControlParameterValueKind kind)
RobotControlParameters * controlParameters
CheaterState< double > * cheaterState
Common Leg Control Interface and Leg Control Algorithms.
char name[CONTROL_PARAMETER_MAXIMUM_NAME_LENGTH]
ControlParameterValue value
virtual ControlParameters * getUserControlParameters()=0
RobotRunner * _robotRunner
RobotControlParameters _robotParams
int receive_sbus(int port)
VisualizationData * visualizationData
SharedMemoryObject< SimulatorSyncronizedMessage > _sharedMemory
std::string generateUnitializedList()
RobotController * _robot_ctrl