Commit fde7ae29 authored by Timothy Stack's avatar Timothy Stack

Rmcd and garcia stuff:

	* configure, configure.in: Add robot related template files.

	* robots/GNUmakefile.in: Add primotion directory.

	* robots/emc/emcd.c: Debugging printfs, check the status for
	update-position messages from rmc, and add a basic handler for
	emulab clients.

	* robots/emc/test_emcd.sh.in: Update for changes in mtp.

	* robots/mtp/mtp.h, robots/mtp/mtp.c: Changes for the garcia.

	* robots/mtp/mtp_send.c: Fixes so that it will compile under
	linux.

	* robots/primotion/GNUmakefile.in: Makefile for building a fake
	gorobot in the testbed tree.

	* robots/primotion/Makefile: tweaks

	* robots/primotion/gorobot.cc: First draft with sort-of working
	networking code.

	* robots/primotion/test_gorobot.sh.in: Test case for the fake
	gorobot.

	* robots/primotion/dgrobot/GNUmakefile.in: Makefile for building a
	fake grobot class in the testbed tree.

	* robots/primotion/dgrobot/grobot.h: Add #if !defined(GROBOT_SIM)
	conditionals.

	* robots/primotion/dgrobot/grobot_sim.cc: Empty impl of grobot
	class used for testing.

	* robots/rmcd/GNUmakefile.in: Targets for building rmcd and
	running its test case.

	* robots/rmcd/rmcd.c: First draft with sort-of working networking
	code.

	* robots/rmcd/test_emcd.config: emcd configuration for the rmcd
	test case.

	* robots/rmcd/test_rmcd.sh.in: Test case for rmcd.
parent d50c5e8b
......@@ -1585,7 +1585,9 @@ outfiles="$outfiles Makeconf GNUmakefile \
mote/GNUmakefile mote/tbuisp \
robots/GNUmakefile robots/mtp/GNUmakefile robots/emc/GNUmakefile \
robots/emc/test_emcd.sh robots/emc/loclistener \
robots/vmcd/GNUmakefile robots/vmcd/test_vmc-client.sh "
robots/vmcd/GNUmakefile robots/vmcd/test_vmc-client.sh \
robots/rmcd/GNUmakefile robots/primotion/GNUmakefile \
robots/primotion/test_gorobot.sh robots/primotion/dgrobot/GNUmakefile "
#
# Do this for easy distclean.
......
......@@ -615,7 +615,9 @@ outfiles="$outfiles Makeconf GNUmakefile \
mote/GNUmakefile mote/tbuisp \
robots/GNUmakefile robots/mtp/GNUmakefile robots/emc/GNUmakefile \
robots/emc/test_emcd.sh robots/emc/loclistener \
robots/vmcd/GNUmakefile robots/vmcd/test_vmc-client.sh "
robots/vmcd/GNUmakefile robots/vmcd/test_vmc-client.sh \
robots/rmcd/GNUmakefile robots/primotion/GNUmakefile \
robots/primotion/test_gorobot.sh robots/primotion/dgrobot/GNUmakefile "
#
# Do this for easy distclean.
......
......@@ -11,7 +11,7 @@ SUBDIR = robots
include $(OBJDIR)/Makeconf
SUBDIRS = mtp emc vmcd rmcd
SUBDIRS = mtp emc vmcd primotion rmcd
all: all-subdirs
check: check-subdirs
......
......@@ -735,7 +735,8 @@ int unknown_client_callback(elvin_io_handler_t handler,
else {
// add descriptor to list, etc:
rmc_data.sock_fd = fd;
rmc_data.position_list = robot_list_create();
if (rmc_data.position_list == NULL)
rmc_data.position_list = robot_list_create();
retval = 1;
}
......@@ -755,7 +756,7 @@ int unknown_client_callback(elvin_io_handler_t handler,
emulab_callback,
NULL,
eerror) == NULL) {
error("unable to add elvin io handler");
error("unable to add elvin io handler");
}
else {
emulab_sock = fd;
......@@ -859,6 +860,8 @@ int rmc_callback(elvin_io_handler_t handler,
mtp_packet_t *mp = NULL;
int rc, retval = 0;
info("rmc packet\n");
if (((rc = mtp_receive_packet(fd, &mp)) != MTP_PP_SUCCESS) ||
(mp->version != MTP_VERSION)) {
error("invalid client %p\n", mp);
......@@ -877,10 +880,16 @@ int rmc_callback(elvin_io_handler_t handler,
struct mtp_update_position up_copy;
struct mtp_packet *wb;
info("request pos\n");
vmc_up = (struct mtp_update_position *)
robot_list_search(vmc_data.position_list, my_id);
rmc_up = (struct mtp_update_position *)
robot_list_search(rmc_data.position_list, my_id);
if (vmc_up != NULL) {
rmc_up = vmc_up; // XXX prefer vmc?
}
if (rmc_up != NULL) {
// since VMC isn't hooked in, we simply write back the rmc posit
......@@ -891,9 +900,11 @@ int rmc_callback(elvin_io_handler_t handler,
wb = mtp_make_packet(MTP_UPDATE_POSITION, MTP_ROLE_EMC, &up_copy);
mtp_send_packet(fd, wb);
}
else {
else {
struct mtp_control mc;
info("no updates for %d\n", my_id);
mc.id = -1;
mc.code = -1;
mc.msg = "position not updated yet";
......@@ -924,6 +935,18 @@ int rmc_callback(elvin_io_handler_t handler,
malloc(sizeof(struct mtp_update_position));
*up_copy = *(mp->data.update_position);
robot_list_append(rmc->position_list, my_id, up_copy);
info("update pos\n");
switch (mp->data.update_position->status) {
case MTP_POSITION_STATUS_ERROR:
case MTP_POSITION_STATUS_COMPLETE:
if (emulab_sock != -1) {
info("complete!\n");
mtp_send_packet(emulab_sock, mp);
}
break;
}
// also, if status is MTP_POSITION_STATUS_COMPLETE ||
// MTP_POSITION_STATUS_ERROR, notify emulab, or issue the next
......@@ -959,7 +982,7 @@ int rmc_callback(elvin_io_handler_t handler,
mp = NULL;
if (!retval) {
info("dropping connection %d\n", fd);
info("dropping rmc connection %d\n", fd);
elvin_sync_remove_io_handler(handler, eerror);
......@@ -977,12 +1000,62 @@ int emulab_callback(elvin_io_handler_t handler,
void *rock,
elvin_error_t eerror)
{
char buf[1024];
int retval = 0;
mtp_packet_t *mp = NULL;
int rc, retval = 0;
if (((rc = mtp_receive_packet(fd, &mp)) != MTP_PP_SUCCESS) ||
(mp->version != MTP_VERSION)) {
error("invalid client %p\n", mp);
}
else {
switch (mp->opcode) {
case MTP_COMMAND_GOTO:
if (rmc_data.sock_fd == -1) {
error("no rmcd yet\n");
}
else if (mtp_send_packet(rmc_data.sock_fd, mp) != MTP_PP_SUCCESS) {
error("could not forward packet to rmcd\n");
}
else {
info("forwarded goto\n");
retval = 1;
}
break;
default:
{
struct mtp_packet *wb;
struct mtp_control c;
error("received bogus opcode from VMC: %d\n", mp->opcode);
c.id = -1;
c.code = -1;
c.msg = "protocol error: bad opcode";
wb = mtp_make_packet(MTP_CONTROL_ERROR, MTP_ROLE_EMC, &c);
mtp_send_packet(fd, wb);
free(wb);
wb = NULL;
}
break;
}
}
printf("emulab callback\n");
read(fd, buf, sizeof(buf));
mtp_free_packet(mp);
mp = NULL;
if (!retval) {
info("dropping emulab connection %d\n", fd);
elvin_sync_remove_io_handler(handler, eerror);
emulab_sock = -1;
close(fd);
fd = -1;
}
return retval;
}
......@@ -1017,6 +1090,10 @@ int vmc_callback(elvin_io_handler_t handler,
malloc(sizeof(struct mtp_update_position));
*up_copy = *(mp->data.update_position);
robot_list_append(vmc->position_list, my_id, up_copy);
info("update for %d %p\n",
my_id,
robot_list_search(vmc_data.position_list, my_id));
// also, if status is MTP_POSITION_STATUS_COMPLETE ||
// MTP_POSITION_STATUS_ERROR, notify emulab, or issue the next
......@@ -1052,7 +1129,7 @@ int vmc_callback(elvin_io_handler_t handler,
mp = NULL;
if (!retval) {
info("dropping connection %d\n", fd);
info("dropping vmc connection %d\n", fd);
elvin_sync_remove_io_handler(handler, eerror);
......
......@@ -45,14 +45,14 @@ run_test ../mtp/mtp_send -n localhost -P ${PORT} \
-w -r rmc -i 1 request-position
check_output "init -> request-position failed?" <<EOF
Packet: length 71; version 1; role 0
Packet: length 76; version 1; role 0
opcode: config-rmc
num: 2
horiz: 3.657600
vert: 2.438400
robot[0]: 1, garcia1.flux.utah.edu
robot[1]: 2, garcia2.flux.utah.edu
Packet: length 40; version 1; role 0
Packet: length 44; version 1; role 0
opcode: error
id: -1
code: -1
......@@ -65,14 +65,14 @@ run_test ../mtp/mtp_send -n localhost -P ${PORT} \
-w -r rmc -i 1 request-position
check_output "init -> update-position -> request-position failed?" <<EOF
Packet: length 71; version 1; role 0
Packet: length 76; version 1; role 0
opcode: config-rmc
num: 2
horiz: 3.657600
vert: 2.438400
robot[0]: 1, garcia1.flux.utah.edu
robot[1]: 2, garcia2.flux.utah.edu
Packet: length 35; version 1; role 0
Packet: length 36; version 1; role 0
opcode: update-position
id: 1
x: 6.000000
......
#include "config.h"
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <unistd.h>
......@@ -17,8 +16,11 @@ static int readall(int fd,char *buffer,unsigned int len)
assert(fd >= 0);
assert(buffer != NULL);
while ((rc = read(fd,&buffer[off],len - off)) > 0) {
off += rc;
while (((rc = read(fd,&buffer[off],len - off)) > 0) ||
((rc == -1) && (errno == EINTR))) {
if (rc > 0) {
off += rc;
}
}
if (rc < 0) {
......@@ -70,7 +72,7 @@ int mtp_receive_packet(int fd,struct mtp_packet **packet) {
// copy the header bytes to the new buf
memcpy(buf,&clength,4);
retval = readall(fd,(void*)&buf[MTP_PACKET_HEADER_OFFSET_OPCODE],remaining_length);
retval = readall(fd,&buf[MTP_PACKET_HEADER_OFFSET_OPCODE],remaining_length);
if (retval == -1) {
free(buf);
return MTP_PP_ERROR_READ;
......@@ -128,6 +130,7 @@ int endian() {
__z.d = val; \
if (endian() == 1) { \
memcpy((char *)((buf)+(idx)),__z.c,sizeof(double)); \
idx += 8; \
} \
else { \
*((int *)((buf)+(idx))) = htonl(*((int *)(__z.c + 4))); \
......@@ -146,6 +149,7 @@ int endian() {
if (endian() == 1) { \
memcpy((char *)(__z.c),(char *)((buf)+(idx)),sizeof(double)); \
val = __z.d; \
idx += 8; \
} \
else { \
*((int *)(__z.c + 4)) = htonl(*((int *)((buf) + (idx)))); \
......@@ -188,7 +192,8 @@ int mtp_encode_packet(char **buf_ptr,struct mtp_packet *packet) {
packet->opcode == MTP_CONTROL_INIT ||
packet->opcode == MTP_CONTROL_CLOSE) {
struct mtp_control *data = packet->data.control;
int len;
*((int *)buf) = htonl(buf_size);
buf[MTP_PACKET_HEADER_OFFSET_OPCODE] = (char)(packet->opcode);
buf[MTP_PACKET_HEADER_OFFSET_VERSION] = (char)(packet->version);
......@@ -203,7 +208,8 @@ int mtp_encode_packet(char **buf_ptr,struct mtp_packet *packet) {
i += 4;
// write msg field
strcpy(&buf[i],data->msg);
i += strlen(&buf[i]) + 1;
len = strlen(&buf[i]) + 1;
i += (len + 3) & ~3;
}
else if (packet->opcode == MTP_CONFIG_RMC) {
struct mtp_config_rmc *data = packet->data.config_rmc;
......@@ -219,12 +225,15 @@ int mtp_encode_packet(char **buf_ptr,struct mtp_packet *packet) {
i += 4;
// now write the list
for (j = 0; j < data->num_robots; ++j) {
int len;
// write the id field
*((int *)(buf+i)) = htonl(data->robots[j].id);
i += 4;
// write the hostname field
strcpy(&buf[i],data->robots[j].hostname);
i += strlen(&buf[i]) + 1;
len = strlen(&buf[i]) + 1;
i += (len + 3) & ~3;
}
// now write the global_bound data
encode_float32(buf, i, data->box.horizontal);
......@@ -244,12 +253,15 @@ int mtp_encode_packet(char **buf_ptr,struct mtp_packet *packet) {
i += 4;
// now write the list
for (j = 0; j < data->num_robots; ++j) {
int len;
// write the id field
*((int *)(buf+i)) = htonl(data->robots[j].id);
i += 4;
// write the hostname field
strcpy(&buf[i],data->robots[j].hostname);
i += strlen(&buf[i]) + 1;
len = strlen(&buf[i]) + 1;
i += (len + 3) & ~3;
}
}
......@@ -336,11 +348,11 @@ int mtp_encode_packet(char **buf_ptr,struct mtp_packet *packet) {
i += 4;
*((int *)(buf+i)) = htonl(data->robot_id);
i += 4;
encode_float32(buf, i, data->position.x);
encode_float32(buf, i, data->position.y);
encode_float32(buf, i, data->position.theta);
encode_float64(buf, i, data->position.timestamp);
encode_float64(buf, i, data->position.timestamp);
}
else if (packet->opcode == MTP_COMMAND_STOP) {
struct mtp_command_stop *data = packet->data.command_stop;
......@@ -429,7 +441,7 @@ int mtp_decode_packet(char *buf,struct mtp_packet **packet_ptr) {
len = strlen(buf+i) + 1;
data->robots[j].hostname = (char *)malloc(sizeof(char)*len);
memcpy(data->robots[j].hostname,buf+i,len);
i += len;
i += (len + 3) & ~3;
}
// write the global_coord box
decode_float32(buf, i, data->box.horizontal);
......@@ -455,7 +467,7 @@ int mtp_decode_packet(char *buf,struct mtp_packet **packet_ptr) {
len = strlen(buf+i) + 1;
data->robots[j].hostname = (char *)malloc(sizeof(char)*len);
memcpy(data->robots[j].hostname,buf+i,len);
i += len;
i += (len + 3) & ~3;
}
}
......@@ -476,7 +488,7 @@ int mtp_decode_packet(char *buf,struct mtp_packet **packet_ptr) {
}
packet->data.request_id = data;
data->request_id = ntohl(*((int *)(buf+i)));
data->request_id = ntohl(*((int *)(buf+i)));
i += 4;
decode_float32(buf, i, data->position.x);
decode_float32(buf, i, data->position.y);
......@@ -688,18 +700,24 @@ int mtp_calc_size(int opcode,void *data) {
opcode == MTP_CONTROL_INIT ||
opcode == MTP_CONTROL_CLOSE) {
struct mtp_control *c = (struct mtp_control *)data;
int len;
assert(c->msg);
retval += 8;
retval += strlen(c->msg) + 1;
len = strlen(c->msg) + 1;
retval += (len + 3) & ~3;
}
else if (opcode == MTP_CONFIG_RMC) {
struct mtp_config_rmc *c = (struct mtp_config_rmc *)data;
retval += 4;
for (i = 0; i < c->num_robots; ++i) {
int len;
assert(c->robots[i].hostname);
retval += 4;
retval += strlen(c->robots[i].hostname) + 1;
len = strlen(c->robots[i].hostname) + 1;
retval += (len + 3) & ~3;
}
retval += 8;
}
......@@ -707,10 +725,13 @@ int mtp_calc_size(int opcode,void *data) {
struct mtp_config_vmc *c = (struct mtp_config_vmc *)data;
retval += 4;
for (i = 0; i < c->num_robots; ++i) {
int len;
assert(c->robots[i].hostname);
retval += 4;
retval += strlen(c->robots[i].hostname) + 1;
len = strlen(c->robots[i].hostname) + 1;
retval += (len + 3) & ~3;
}
}
else if (opcode == MTP_REQUEST_POSITION) {
......
......@@ -3,6 +3,10 @@
#ifndef __MTP_H__
#define __MTP_H__
#ifdef __cplusplus
extern "C" {
#endif
/* version number */
#define MTP_VERSION 0x1
......@@ -69,7 +73,7 @@
* :-) Obey the protocol or prepare to have your connection terminated!
*/
#define MTP_PACKET_MAXLEN 32768
#define MTP_PACKET_HEADER_LEN 7
#define MTP_PACKET_HEADER_LEN 8
#define MTP_PACKET_HEADER_OFFSET_LENGTH 0
#define MTP_PACKET_HEADER_OFFSET_OPCODE 4
#define MTP_PACKET_HEADER_OFFSET_VERSION 5
......@@ -198,5 +202,8 @@ void mtp_print_packet(FILE *file, struct mtp_packet *mp);
/* data's type is known by opcode! */
int mtp_calc_size(int opcode,void *data);
#ifdef __cplusplus
}
#endif
#endif
#include "config.h"
#include <errno.h>
#include <float.h>
#include <stdio.h>
......@@ -508,7 +506,9 @@ static int interpret_options(int *argcp, char ***argvp)
if (fd == -1) {
memset(&sin, 0, sizeof(sin));
#if !defined(linux)
sin.sin_len = sizeof(sin);
#endif
sin.sin_family = AF_INET;
sin.sin_port = htons(args.port);
......@@ -554,7 +554,9 @@ static int interpret_options(int *argcp, char ***argvp)
}
}
#if !defined(linux)
optreset = 1;
#endif
optind = 1;
return retval;
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004 University of Utah and the Flux Group.
# All rights reserved.
#
SRCDIR = @srcdir@
TESTBED_SRCDIR = @top_srcdir@
OBJDIR = ../..
SUBDIR = robots/primotion
include $(OBJDIR)/Makeconf
SUBDIRS = dgrobot
PROGS = gorobot
TESTS = test_gorobot.sh
all: all-subdirs $(PROGS)
include $(TESTBED_SRCDIR)/GNUmakerules
CXXFLAGS += -O -g -Wall -I${OBJDIR} -I/usr/local/include
CXXFLAGS += -I${SRCDIR}/../mtp
CXXFLAGS += -DGROBOT_SIM
LDFLAGS = -L../mtp -Ldgrobot
LIBS += -lmtp -ldgrobot
test_gorobot.sh: gorobot
gorobot: gorobot.o ../mtp/libmtp.a dgrobot/libdgrobot.a
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ gorobot.o $(LIBS)
clean: clean-subdirs
rm -f *.o
# How to recursively descend into subdirectories to make general
# targets such as `all'.
%.MAKE:
@$(MAKE) -C $(dir $@) $(basename $(notdir $@))
%-subdirs: $(addsuffix /%.MAKE,$(SUBDIRS)) ;
.PHONY: $(SUBDIRS)
......@@ -10,8 +10,9 @@ HOSTPATH=/z/garcia/brainstem
# Build for Stargate:
ARCH=ARM
CC=/usr/local/arm/3.4.1/bin/arm-linux-g++
CFLAGS=-DaUNIX -s -static
CC=/usr/local/arm/3.4.1/bin/arm-linux-gcc
CXX=/usr/local/arm/3.4.1/bin/arm-linux-g++
CXXFLAGS = -DaUNIX -s -static
# Build for i386:
#ARCH=i686
......@@ -19,7 +20,7 @@ CFLAGS=-DaUNIX -s -static
#CFLAGS=-DaUNIX -g
INCLUDES=-I$(HOSTPATH)/aCommon \
CXXFLAGS += -I$(HOSTPATH)/aCommon \
-I$(HOSTPATH)/aUnix \
-I$(HOSTPATH)/aIO/aCommon \
-I$(HOSTPATH)/aIO/aUnix \
......@@ -30,23 +31,23 @@ INCLUDES=-I$(HOSTPATH)/aCommon \
-I$(HOSTPATH)/aGarcia/aGarcia \
-I$(HOSTPATH)/aGarcia/aUnix \
-I$(HOSTPATH)/aGarcia/aCommon \
-I../mtp \
-I./
LIBRARIES=\
LIBRARIES =\
-laGarcia \
-laStem \
-laIO \
-laUI \
-lpthread \
-lm \
-I.
VPATH=$(HOSTPATH)/aCommon:$(HOSTPATH)/aUnix
-lm
LDFLAGS=-L$(HOSTPATH)/aRelease/aUnix/$(ARCH)/
VPATH=$(HOSTPATH)/aCommon:$(HOSTPATH)/aUnix:dgrobot:../mtp
LDFLAGS += -L$(HOSTPATH)/aRelease/aUnix/$(ARCH)/
OBJECTSREQ=grobot gcallbacks gbehaviors simplepath
OBJECTS=grobot.o gcallbacks.o gbehaviors.o simplepath.o
OBJECTS=grobot.o gcallbacks.o gbehaviors.o simplepath.o mtp.o
all: commotion pathmotion circle gorobot gorobotc
......@@ -56,17 +57,19 @@ commotion: $(OBJECTSREQ)
pathmotion: $(OBJECTSREQ)
$(CC) -o pathmotion $(OBJECTS) $(INCLUDES) $(CFLAGS) $(LDFLAGS) pathmotion.cc $(LIBRARIES)
circle: $(OBJECTSREQ)
$(CC) -o circle $(OBJECTS) $(INCLUDES) $(CFLAGS) $(LDFLAGS) circle.cc $(LIBRARIES)
gorobot: $(OBJECTSREQ)
$(CC) -o gorobot $(OBJECTS) $(INCLUDES) $(CFLAGS) $(LDFLAGS) gorobot.cc $(LIBRARIES)
gorobot: $(OBJECTS)
$(CXX) -o gorobot $(OBJECTS) $(CXXFLAGS) $(LDFLAGS) gorobot.cc $(LIBRARIES)
mtp_send: mtp.o
$(CC) -o mtp_send $(CXXFLAGS) $(LDFLAGS) ../mtp/mtp_send.c $<
gorobotc: $(OBJECTSREQ)
$(CC) -o gorobotc $(OBJECTS) $(INCLUDES) $(CFLAGS) $(LDFLAGS) gorobotc.cc $(LIBRARIES)
# %.o : %.c
# $(CC) $(CFLAGS) -c -o $@ $< $(INCLUDES)
#
......@@ -75,7 +78,7 @@ gorobotc: $(OBJECTSREQ)
grobot:
$(CC) -c $(INCLUDES) $(CFLAGS) dgrobot/grobot.cc
gcallbacks:
$(CC) -c $(INCLUDES) $(CFLAGS) dgrobot/gcallbacks.cc
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004 University of Utah and the Flux Group.
# All rights reserved.
#
SRCDIR = @srcdir@
TESTBED_SRCDIR = @top_srcdir@
OBJDIR = ../../..
SUBDIR = robots/primotion/dgrobot
include $(OBJDIR)/Makeconf
DGLIBS = libdgrobot.a
all: $(DGLIBS)
include $(TESTBED_SRCDIR)/GNUmakerules
OBJS = grobot_sim.o
CXXFLAGS += -O -g -Wall -I${OBJDIR} -I/usr/local/include
grobot_sim.o: grobot.h
libdgrobot.a: $(OBJS)
$(AR) crv $@ $^
$(RANLIB) $@
clean:
/bin/rm -f *.o *.a $(MTPPROGS)
......@@ -10,13 +10,15 @@
#ifndef GROBOT_H
#define GROBOT_H
class grobot;
#if !defined(GROBOT_SIM)
#include "acpGarcia.h"
#include "acpValue.h"
class grobot;
#include "gcallbacks.h"
#include "gbehaviors.h"
#endif
#include <math.h>
#include <iostream>
......@@ -52,8 +54,9 @@ class grobot {
void setCBexec(int id);
void setCBstatus(int id, int stat);
#if !defined(GROBOT_SIM)
acpGarcia garcia;
#endif
private:
void createNULLbehavior();
......@@ -86,7 +89,7 @@ class grobot {
int gotom1; // status for move segment of a goto command
int gotop2; // status for second pivot of a goto command
#if !defined(GROBOT_SIM)
// Garcia stuff
acpObject *pBehavior; // Garcia behavior
......@@ -99,8 +102,7 @@ class grobot {
aIOLib ioRef; // Garcia Input/Output reference
aErr err; // Garcia Error
#endif
};
......
#include "config.h"
#include <stdio.h>
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
#define GROBOT_SIM
#include "grobot.h"
grobot::grobot()
{
}
grobot::~grobot()
{
}
void grobot::estop()
{
}
void grobot::setWheels(float Vl, float Vr)
{
}
void grobot::setvPath(float Wv, float Wr)
{
}
void grobot::pbMove(float mdisplacement)
{
}
void grobot::pbPivot(float pangle)
{
}
void grobot::dgoto(float Dx, float Dy, float Rf)
{
printf("goto %f, %f, %f\n", Dx, Dy, Rf);
this->dx_est = Dx;
this->dy_est = Dy;
this->gotocomplete = 1;
}
void grobot::resetPosition()
{
}
void grobot::updatePosition()
{
}
float grobot::getArclen()
{
return 0.0f;
}
void grobot::getDisplacement(float &dxtemp, float &dytemp)
{
dxtemp = this->dx_est;
dytemp = this->dy_est;
}
int grobot::getGstatus()
{
return 0;
}
int grobot::getGOTOstatus()
{
int retval