Skip to content
Snippets Groups Projects
Commit 9d2bc189 authored by burneykb's avatar burneykb
Browse files

first commit

parent 6d0ecc47
No related branches found
No related tags found
No related merge requests found
#ifndef _CLI_SETPID_H
#define _CLI_SETPID_H
#ifndef CLI_SETPID_H
#define CLI_SETPID_H
#include "frontend_setpid.h"
......
#include <stdio.h>
#include <unistd.h>
#include <getopt.h>
#include "cli_setsetpoint.h"
// #include "frontend_setpid.h"
int cli_set(struct backend_conn * conn, int argc, char **argv) {
int c;
struct frontend_pid_data pid_data;
static int needHelp = 0;
static struct option long_options[] = {
/* These options don’t set a flag. We distinguish them by their indices. */
{"help", no_argument, &needHelp, 1},
{0, 0, 0, 0}
};
while (1)
{
/* getopt_long stores the option index here. */
int option_index = 0;
c = getopt_long(argc, argv, "", long_options, &option_index);
/* Detect the end of the options. */
if (c == -1)
break;
}
if (needHelp) {
printf("Setsetpoint sets the x, y , or z set point values for the quad.\n");
printf("Usage Syntax : \n\t./Cli setsetpoint [options...]\n");
printf("Symlink Usage Syntax : \n\t./setsetpoint [options...]\n\n");
printf("Available options include the following\n");
printf("\t[-x] 'val' : Sets the x setpoint value to 'val'\n");
printf("\t[-z] 'val' : Sets the y setpoint value to 'val'\n");
printf("\t[-z] 'val' : Sets the z setpoint value to 'val'\n");
return 0;
}
if (argc < 2) {
printf("Incorrect Usage, run './cli setpid --help' for correct usage.\n");
return 1;
}
if (setRoll) {
pid_data.controller = PID_ROLL;
} else if (setYaw) {
pid_data.controller = PID_YAW;
} else if (setPitch) {
pid_data.controller = PID_PITCH;
} else if (setRollV) {
pid_data.controller = PID_ROLL_RATE;
} else if (setPitchV) {
pid_data.controller = PID_PITCH_RATE;
} else if (setYawV) {
pid_data.controller = PID_YAW_RATE;
} else if (setHeight) {
pid_data.controller = PID_HEIGHT;
} else if (setLong) {
pid_data.controller = PID_LAT;
} else if (setLat) {
pid_data.controller = PID_LONG;
}
frontend_setpid(conn, &pid_data, mask);
return 0;
}
#ifndef CLI_SETSETPOINT_H
#define CLI_SETSETPOINT_H
// #include "frontend_setpid.h"
int cli_setsetpoint(struct backend_conn * conn, int argc, char ** argv);
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment