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

Ready to pull new command changes

parent 60e55d29
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@
int cli_getsetpoint(struct backend_conn * conn, int argc, char **argv) {
int c;
static int getheight = 0, getlat = 0, getlong = 0;
static int getpitch = 0, getroll = 0, getyaw = 0;
struct frontend_setpoint_data setpoint_data;
static int needHelp = 0;
static int mask;
......@@ -16,6 +17,9 @@ int cli_getsetpoint(struct backend_conn * conn, int argc, char **argv) {
{"height", no_argument, &getheight, 1},
{"long", no_argument, &getlong, 1},
{"lat", no_argument, &getlat, 1},
{"pitch", no_argument, &getpitch, 1},
{"roll", no_argument, &getroll, 1},
{"yaw", no_argument, &getyaw, 1},
{0, 0, 0, 0}
};
......@@ -35,18 +39,24 @@ int cli_getsetpoint(struct backend_conn * conn, int argc, char **argv) {
getheight = 1;
getlat = 1;
getlong = 1;
getpitch = 1;
getroll = 1;
getyaw = 1;
}
}
if (needHelp) {
printf("Getsetpoint gets the height, lat , and long set point values for the quad.\n");
printf("Getsetpoint gets the height, lat, long, pitch, roll and yaw set point values for the quad.\n");
printf("Usage Syntax : \n\t./Cli getsetpoint [options...]\n");
printf("Symlink Usage Syntax : \n\t./getsetpoint [options...]\n\n");
printf("Available options include the following\n");
printf("\t[--height] : Gets the height setpoint\n");
printf("\t[--lat] : Gets the latitude setpoint\n");
printf("\t[--long] : Gets the longitude setpoint\n");
printf("\t[--pitch] : Gets the pitch setpoint\n");
printf("\t[--roll] : Gets the roll setpoint\n");
printf("\t[--yaw] : Gets the yaw setpoint\n");
return 0;
}
......@@ -70,6 +80,21 @@ int cli_getsetpoint(struct backend_conn * conn, int argc, char **argv) {
return result;
}
}
if(getpitch) {
if ((result = getSetPointValues(conn, &setpoint_data, PITCH))) {
return result;
}
}
if(getroll) {
if ((result = getSetPointValues(conn, &setpoint_data, ROLL))) {
return result;
}
}
if(getyaw) {
if ((result = getSetPointValues(conn, &setpoint_data, YAW))) {
return result;
}
}
return 0;
}
......@@ -90,6 +115,16 @@ int getSetPointValues(struct backend_conn * conn, struct frontend_setpoint_data
case LONGG :
printf("Longitude: %f\n",
setpoint_data->longg);
case PITCH :
printf("Pitch: %f\n",
setpoint_data->pitch);
break;
case ROLL :
printf("Roll: %f\n",
setpoint_data->roll);
case YAW :
printf("Yaw: %f\n",
setpoint_data->yaw);
default :
break;
}
......
......@@ -3,9 +3,14 @@
#include "frontend_getsetpoint.h"
#define HEIGHT 0
#define LAT 1
#define LONGG 2
enum {
HEIGHT,
LAT,
LONGG,
PITCH,
ROLL,
YAW
};
int getSetPointValues(struct backend_conn *, struct frontend_setpoint_data *, int type);
int cli_getsetpoint(struct backend_conn * conn, int argc, char ** argv);
......
......@@ -7,15 +7,19 @@
int cli_setsetpoint(struct backend_conn * conn, int argc, char **argv) {
int c;
static int setheight = 0, setlat = 0, setlong = 0;
static int setpitch = 0, setroll = 0, setyaw = 0;
struct frontend_setpoint_data setpoint_data;
static int needHelp = 0;
static int mask;
static struct option long_options[] = {
/* These options don’t set a flag. We distinguish them by their indices. */
{"help", no_argument, &needHelp, 1},
{"help", no_argument, &needHelp, 1},
{"height", required_argument, 0, 'h'},
{"long", required_argument, 0, 'l'},
{"lat", required_argument, 0, 't'},
{"pitch", required_argument, 0, 'p'},
{"roll", required_argument, 0, 'r'},
{"yaw", required_argument, 0, 'y'},
{0, 0, 0, 0}
};
......@@ -43,6 +47,18 @@ int cli_setsetpoint(struct backend_conn * conn, int argc, char **argv) {
setpoint_data.longg = atof(optarg);
mask |= SET_LONG;
break;
case 'p' :
setpoint_data.pitch = atof(optarg);
mask |= SET_PITCH;
break;
case 'r' :
setpoint_data.roll = atof(optarg);
mask |= SET_ROLL;
break;
case 'y' :
setpoint_data.yaw = atof(optarg);
mask |= SET_YAW;
break;
default :
break;
}
......@@ -50,13 +66,16 @@ int cli_setsetpoint(struct backend_conn * conn, int argc, char **argv) {
}
if (needHelp) {
printf("Setsetpoint sets the height, lat , or long set point values for the quad.\n");
printf("Setsetpoint sets the height, lat, long, pitch, roll, or yaw 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[--height] 'val' : Sets the height setpoint value to 'val'\n");
printf("\t[--lat] 'val' : Sets the latitude setpoint value to 'val'\n");
printf("\t[--long] 'val' : Sets the longitude setpoint value to 'val'\n");
printf("\t[--pitch] 'val' : Sets the pitch setpoint value to 'val'\n");
printf("\t[--roll] 'val' : Sets the roll setpoint value to 'val'\n");
printf("\t[--yaw] 'val' : Sets the yaw setpoint value to 'val'\n");
return 0;
}
......
......@@ -33,6 +33,15 @@ int frontend_getsetpoint(
case LONGG :
strncpy(line, "getlong\n", 8);
break;
case PITCH :
strncpy(line, "getpitch\n", 9);
break;
case ROLL :
strncpy(line, "getroll\n", 8);
break;
case YAW :
strncpy(line, "getyaw\n", 7);
break;
}
int size;
if((size = ucart_backendWrite(conn, line)) < 0 ) {
......
......@@ -12,9 +12,12 @@ int frontend_setsetpoint(
#define SET_LAT 0x01
#define SET_LONG 0x02
#define SET_HEIGHT 0x04
#define SET_PITCH 0x08
#define SET_ROLL 0x10
#define SET_YAW 0x20
#ifndef SET_ALL
#define SET_ALL (SET_LAT | SET_LONG | SET_HEIGHT)
#define SET_ALL (SET_LAT | SET_LONG | SET_HEIGHT | SET_PITCH | SET_ROLL | SET_YAW)
#endif /* SET_ALL */
#endif /* __FRONTEND_SETSETPOINT_H */
\ No newline at end of file
......@@ -6,6 +6,9 @@ struct frontend_setpoint_data {
float lat;
/* names with two g's due to long type name */
float longg;
float pitch;
float roll;
float yaw;
};
......
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