VehicleDifferential_ControllerRaw.cpp
Go to the documentation of this file.
1 /*+-------------------------------------------------------------------------+
2  | MultiVehicle simulator (libmvsim) |
3  | |
4  | Copyright (C) 2014-2020 Jose Luis Blanco Claraco |
5  | Copyright (C) 2017 Borys Tymchenko (Odessa Polytechnic University) |
6  | Distributed under 3-clause BSD License |
7  | See COPYING |
8  +-------------------------------------------------------------------------+ */
9 
11 //#include <mvsim/World.h>
12 //#include <rapidxml.hpp>
13 
14 using namespace mvsim;
15 using namespace std;
16 
17 // See base class docs
21 {
22  co.wheel_torque_l = this->setpoint_wheel_torque_l;
23  co.wheel_torque_r = this->setpoint_wheel_torque_r;
24 }
25 
27  const TeleopInput& in, TeleopOutput& out)
28 {
29  ControllerBase::teleop_interface(in, out);
30 
31  switch (in.keycode)
32  {
33  case 'W':
34  case 'w':
35  setpoint_wheel_torque_l -= 0.5;
36  setpoint_wheel_torque_r -= 0.5;
37  break;
38 
39  case 'S':
40  case 's':
41  setpoint_wheel_torque_l += 0.5;
42  setpoint_wheel_torque_r += 0.5;
43  break;
44 
45  case 'A':
46  case 'a':
47  setpoint_wheel_torque_l += 0.5;
48  setpoint_wheel_torque_r -= 0.5;
49  break;
50 
51  case 'D':
52  case 'd':
53  setpoint_wheel_torque_l -= 0.5;
54  setpoint_wheel_torque_r += 0.5;
55  break;
56 
57  case ' ':
58  setpoint_wheel_torque_l = setpoint_wheel_torque_r = 0.0;
59  break;
60  };
61  out.append_gui_lines += "[Controller=" + string(class_name()) +
62  "] Teleop keys: w/s=incr/decr both torques. "
63  "a/d=left/right. spacebar=stop.\n";
65  "setpoint: tl=%.03f tr=%.03f deg\n", setpoint_wheel_torque_l,
66  setpoint_wheel_torque_r);
67 }
GLuint in
virtual void teleop_interface(const TeleopInput &in, TeleopOutput &out) override
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
virtual void control_step(const DynamicsDifferential::TControllerInput &ci, DynamicsDifferential::TControllerOutput &co) override
GLsizei const GLcharARB ** string


mvsim
Author(s):
autogenerated on Fri May 7 2021 03:05:51