Gui API functionality
4 posters
Page 1 of 1
Gui API functionality
This is what I made for the api to interact with the gui.
What still needs to be done with this...
1) Stub code, I have to write what?
2) Is robot code needed? One laptop only "talks" to one webapp, but it puts the image on fa? Probably better to have it and not need it that the other way.
3) Will any of the commands need to send data that the gui has to send to us? Can probably delete size and data from receive command.
4) Do we need something to say the other robot was hit to say the game is over?
5) What exactly does the reset command need to do?
- Code:
// Robot codes
#define NO_ROBOT 0
#define ROBOT1 1
#define ROBOT2 2
// Codes for rover commands
#define ROVER_FORWARDS 101
#define ROVER_BACKWARDS 102
#define ROVER_RIGHT 103
#define ROVER_LEFT 104
// Codes for camera commands
#define FRONT_CAMERA_UP 201
#define FRONT_CAMERA_DOWN 202
#define FRONT_CAMERA_RIGHT 203
#define FRONT_CAMERA_LEFT 204
#define FRONT_CAMERA_ZOOM_IN 205
#define FRONT_CAMERA_ZOOM_OUT 206
// Codes for gun commands
#define GUN_UP 301
#define GUN_DOWN 302
#define GUN_RIGHT 303
#define GUN_LEFT 304
#define GUN_FIRE 305
// Codes for sensor/dart commands
#define ROBOT_HIT 401
#define NO_DARTS 402
#define ONE_DARTS 403
#define TWO_DARTS 404
#define THREE_DARTS 405
// Codes for general commands
#define RESET -999
// Codes for in-room camera select
#define CAMERA_TOP 501
#define CAMERA_TOP_LEFT 502
#define CAMERA_TOP_RIGHT 503
#define CAMERA_BOTTOM 504
#define CAMERA_BOTTOM_LEFT 505
#define CAMERA_BOTTOM_RIGHT 506
// Receives a command from the GUI group and initiates the proper action(s)
// based on the data received.
bool ReceiveCommand_Gui (
int robot, // robot id
int cmd, // command id
int len, // length of the data, 0 if no data
void *data // the data
);
// Sends the desired overhead image feed to the gui
bool SendImage_Overhead(
int camera_feed // code for desired camera feed
);
// Sends the desired rover image feed to the gui
bool SendImage_Rover(
int robot // code for robot
);
// Reports the status of the dart gun and hits to the gui
bool SendDart_Status(
int robot, // code for the robot
int status // status code for the dart gun
);
What still needs to be done with this...
1) Stub code, I have to write what?
2) Is robot code needed? One laptop only "talks" to one webapp, but it puts the image on fa? Probably better to have it and not need it that the other way.
3) Will any of the commands need to send data that the gui has to send to us? Can probably delete size and data from receive command.
4) Do we need something to say the other robot was hit to say the game is over?
5) What exactly does the reset command need to do?
cdabbott316- Posts : 12
Join date : 2009-01-08
Re: Gui API functionality
cdabbott316 wrote:
// Sends the desired overhead image feed to the gui
bool SendImage_Overhead(
int camera_feed // code for desired camera feed
);
// Sends the desired rover image feed to the gui
bool SendImage_Rover(
int robot // code for robot
);
didnt you change this to return a string not an int?
Let me know and send me your doc file or port it here so i can compile and send him everything tomorrow.
And I need your stub code for the functions that the gui group is going to provide
dsmarsh- Posts : 54
Join date : 2009-01-08
Age : 38
Re: Gui API functionality
I think this is the final .h stuff
is the receiveGuiDart really more like a reportGuiDart in the sense that we only call it when there has been a hit?
And this is the stub code, I am still kinda unsure why the GUI group is writing this but whatever.
We have to write SendCommCommand and ReceiveCommImage so there is no stub code for those.
is the receiveGuiDart really more like a reportGuiDart in the sense that we only call it when there has been a hit?
- Code:
// Robot codes
#define NO_ROBOT 0
#define ROBOT1 1
#define ROBOT2 2
//Codes for commands
#define ROVER_FORWARDS 101
#define ROVER_BACKWARDS 102
#define ROVER_RIGHT 103
#define ROVER_LEFT 104
#define FRONT_CAMERA_UP 201
#define FRONT_CAMERA_DOWN 202
#define FRONT_CAMERA_RIGHT 203
#define FRONT_CAMERA_LEFT 204
#define FRONT_CAMERA_ZOOM_IN 205
#define FRONT_CAMERA_ZOOM_OUT 206
#define GUN_UP 301
#define GUN_DOWN 302
#define GUN_RIGHT 303
#define GUN_LEFT 304
#define GUN_FIRE 305
#define INITIALIZE -111
#define KILL -555
#define RESET -999
//codes for camera feeds
#define CAMERA_TOP 501
#define CAMERA_TOP_LEFT 502
#define CAMERA_TOP_RIGHT 503
#define CAMERA_BOTTOM 504
#define CAMERA_BOTTOM_LEFT 505
#define CAMERA_BOTTOM_RIGHT 506
#define CAMERA_ROBOT1_FRONT 507
#define CAMERA_ROBOT1_GUN 508
#define CAMERA_ROBOT2_FRONT 509
#define CAMERA_ROBOT2_GUN 510
// Requests that a command be run on a rover
// Returns true if function is called
// false if function is not called
bool SendCommCommand(
int rover_ID, // which rover to send the command to
int command_name // the command code
);
// Requests an image from the server
// Returns a string with the filename or path on the apache server
string ReceiveCommImage(
int camera_feed // which camera feed to get
);
// Requests data on if a rover has been hit
// Returns true if rover has been hit
// false if rover has not been hit
bool ReceiveGuiDart(
int rover_ID // which rover to get the data from
);
And this is the stub code, I am still kinda unsure why the GUI group is writing this but whatever.
We have to write SendCommCommand and ReceiveCommImage so there is no stub code for those.
- Code:
bool ReceiveGuiDart (int rover_ID)
{
bool isHit=true; // or sometimes false
printf("Checking if robot %d was hit\n",rover_ID);
if (isHit) {
printf("Robot %d hit\n",rover_ID);
} else {
printf("Robot %d not hit\n",rover_ID);
}
return isHit;
}
cdabbott316- Posts : 12
Join date : 2009-01-08
Re: Gui API functionality
- Code:
void ReceiveGuiDart (int rover_ID)//this is a game ending function
{
printf("Robot %d was hit\n",rover_ID);//this will be a pause in the gui and a game over, not just a print
}
--this is something that the comm group can call when we see a hit and then the gui group can act on.
I think you are thinking about it wrong.
The gui group isnt going to be writing it like that.
I think it will be something we will call when we know a robot has been hit and then the gui group will write the functions and it will make the gui interface show a game over.
The gui writes it, we call it.
dsmarsh- Posts : 54
Join date : 2009-01-08
Age : 38
Re: Gui API functionality
The GUI groups need to be able to call startFeed(int ID) and endFeed(int ID) where ID is the camera to be used (NETCAM or WEBCAM).
-Brian Peasley
-Brian Peasley
Peasley- Posts : 44
Join date : 2009-01-08
Re: Gui API functionality
Peasley wrote:The GUI groups need to be able to call startFeed(int ID) and endFeed(int ID) where ID is the camera to be used (NETCAM or WEBCAM).
-Brian Peasley
- Code:
// Requests an image from the server
// Returns a string with the filename or path on the apache server
string ReceiveCommImage(
int camera_feed // which camera feed to get
);
This is the same thing right?
dsmarsh- Posts : 54
Join date : 2009-01-08
Age : 38
Re: Gui API functionality
I believe startFeed is the function that starts saving pictures from the camera to the designated folder on the harddrive.
The GUI's ReceiveCommImage is the command that retrieves the image file from FA.
Again, startFeed will need to be part of the initialization from the GUI.
The GUI's ReceiveCommImage is the command that retrieves the image file from FA.
Again, startFeed will need to be part of the initialization from the GUI.
swesson- Posts : 28
Join date : 2009-01-09
Re: Gui API functionality
ReceiveCommImage is not the same. Its as swesson had said. In the initialization routine for the GUI group they need to call startFeed(int ID) to tell the cameras to start capturing. endFeed(int ID) will stop capturing images from the camera, so that should be in there end program routine.
-Brian Peasley
-Brian Peasley
Peasley- Posts : 44
Join date : 2009-01-08
Re: Gui API functionality
Peasley wrote:ReceiveCommImage is not the same. Its as swesson had said. In the initialization routine for the GUI group they need to call startFeed(int ID) to tell the cameras to start capturing. endFeed(int ID) will stop capturing images from the camera, so that should be in there end program routine.
-Brian Peasley
ok, but this could all be done in the same thing, there is no need for the gui group to say, startFeed then ReceiveCommImage
the camera group should always be saving to the img file on the harddrive (on the laptop)
but if you want to add this then let us know because we have to have it in our API by the end of the day.
dsmarsh- Posts : 54
Join date : 2009-01-08
Age : 38
Re: Gui API functionality
The GUI group is going to call something like SendCommand(ROBOT1, INIT).
*At least I'm under the impression they will be calling something like that.
When they do that we can call the startCamera() or whatever. I don't think we need a separate function for that.
We can then call endCamera() whenever we report a hit to the GUI.
As far as the room feeds ...
1) We could start all of the room cameras when init is called or
2) We can have the GUI call a SendCommand(NOROBOT, CAMERA_FEED_X) whenever they want to switch feeds.
*At least I'm under the impression they will be calling something like that.
When they do that we can call the startCamera() or whatever. I don't think we need a separate function for that.
We can then call endCamera() whenever we report a hit to the GUI.
As far as the room feeds ...
1) We could start all of the room cameras when init is called or
2) We can have the GUI call a SendCommand(NOROBOT, CAMERA_FEED_X) whenever they want to switch feeds.
cdabbott316- Posts : 12
Join date : 2009-01-08
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|