10#include <nlohmann/json.hpp>
116 act_bw, vel_cl, noise_resp, max_KS)
166 gm_v, pm_v, msens_v, noise_resp, max_KS,
167 bw_p, bw_v, act_st, pos_cl)
190 double demanded_zeta;
197 demanded_bw, demanded_zeta, state)
220 double demanded_zeta;
227 demanded_st, demanded_zeta, state)
240 std::vector<double> numerators;
243 std::vector<double> denominators;
246 std::string bode_file_path;
272 std::string programPath;
278 std::string pipeAddress;
284 PROCESS_INFORMATION pi;
315 const std::string& pipeAddress);
397 bool send(
const nlohmann::json& jsonObj);
416 nlohmann::json
receive(
unsigned int timeoutMilliseconds = 5000);
435 nlohmann::json
exchange(
const nlohmann::json& jsonObj,
436 unsigned int timeoutMilliseconds = 5000);
498 const nlohmann::json& data);
520 const nlohmann::json& data);
580 const nlohmann::json& data);
Holds the gains resulting from the autotuning process.
Definition: standalone_autotuning.h:75
ControllerGains gains
The resulting controller gains for velocity and position.
Definition: standalone_autotuning.h:78
Holds position and velocity PID gains for a controller.
Definition: standalone_autotuning.h:58
PIDGains velocity
PID gains for the velocity controller.
Definition: standalone_autotuning.h:64
PIDGains position
PID gains for the position controller.
Definition: standalone_autotuning.h:61
Represents the result of a full position autotuning process.
Definition: standalone_autotuning.h:196
Represents the result of a full velocity autotuning process.
Definition: standalone_autotuning.h:165
Definition: standalone_autotuning.h:252
std::string bode_file_path
Full path to the CSV file containing Bode plot data.
Definition: standalone_autotuning.h:255
Represents the gains for a PID controller.
Definition: standalone_autotuning.h:37
double ki
Integral gain.
Definition: standalone_autotuning.h:43
double kd
Derivative gain.
Definition: standalone_autotuning.h:46
double kp
Proportional gain.
Definition: standalone_autotuning.h:40
Represents the result of a plant model identification process.
Definition: standalone_autotuning.h:226
Represents the state of the position autotuning process.
Definition: standalone_autotuning.h:115
Represents an error that occurs during standalone autotuning.
Definition: standalone_autotuning.h:20
std::string message
Descriptive error message.
Definition: standalone_autotuning.h:25
Manages communication and control for an external autotuning process.
Definition: standalone_autotuning.h:269
FullVelocityAutoTuningResult full_auto_tune_velocity_controller(const nlohmann::json &data)
Performs a full velocity controller autotuning sequence using external autotuning program.
Definition: standalone_autotuning.cc:380
ControllerGains auto_tune_position_controller(const nlohmann::json &data)
Performs position controller autotuning using external autotuning program.
Definition: standalone_autotuning.cc:363
nlohmann::json exchange(const nlohmann::json &jsonObj, unsigned int timeoutMilliseconds=5000)
Sends a JSON request and receives a JSON response.
Definition: standalone_autotuning.cc:324
PlantModelResult identify_plant_model(const nlohmann::json &data)
Identifies the plant model based on the input data.
Definition: standalone_autotuning.cc:419
~StandaloneAutotuning()
Destroys the StandaloneAutotuning instance.
Definition: standalone_autotuning.cc:32
bool send(const nlohmann::json &jsonObj)
Sends a JSON object to the external autotuning program through the named pipe or Unix domain socket.
Definition: standalone_autotuning.cc:219
nlohmann::json receive(unsigned int timeoutMilliseconds=5000)
Receives a JSON response from the external autotuning program through the named pipe.
Definition: standalone_autotuning.cc:247
ControllerGains compute_position_controller_gains(const nlohmann::json &data)
Computes the position controller gains without performing full autotuning.
Definition: standalone_autotuning.cc:403
bool connect()
Establishes a connection to the named pipe (Windows) or Unix domain socket (Linux) for communication ...
Definition: standalone_autotuning.cc:153
void disconnect()
Disconnects from the named pipe and terminates the communication with the external autotuning program...
Definition: standalone_autotuning.cc:206
void stop()
Stops the external autotuning process.
Definition: standalone_autotuning.cc:127
FullPositionAutoTuningResult full_auto_tune_position_controller(const nlohmann::json &data)
Performs a full position controller autotuning sequence using external autotuning program.
Definition: standalone_autotuning.cc:392
ControllerGains auto_tune_velocity_controller(const nlohmann::json &data)
Performs velocity controller autotuning using external autotuning program.
Definition: standalone_autotuning.cc:347
bool start()
Starts the external autotuning program by creating a new process.
Definition: standalone_autotuning.cc:34
GeneratePlantBodeFileResult generate_plant_bode_file(const nlohmann::json &data)
Generates the Bode plot CSV file given plant model input data.
Definition: standalone_autotuning.cc:440
static const int BUFFER_SIZE
Size of the communication buffer for pipe transfers.
Definition: standalone_autotuning.h:301
Represents the state of the velocity autotuning process.
Definition: standalone_autotuning.h:91
double vel_cl
Closed-loop velocity value of the system.
Definition: standalone_autotuning.h:106
double noise_resp
Noise response in the velocity autotuning process.
Definition: standalone_autotuning.h:109
double pm
Phase margin of the velocity system.
Definition: standalone_autotuning.h:97
double act_bw
Active bandwidth of the system.
Definition: standalone_autotuning.h:103
double max_KS
Maximum allowed gain scale factor.
Definition: standalone_autotuning.h:112
double gm
Gain margin of the velocity system.
Definition: standalone_autotuning.h:94
double msens
Measurement sensitivity of the velocity system.
Definition: standalone_autotuning.h:100
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(PlantModelResult, numerators, denominators, bode_file_path)