All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 89bf0a7f authored by Timothy Stack's avatar Timothy Stack

A bunch of engineering on the robot code.  I'm sure I've broken something,
but the majority of it is done and I wanted to get a checkpoint in.

	* GNUmakerules: Add rpcgen rules.

	* Makeconf.in: Add PATH and host_cpu variables so
	cross-compilation works properly.  Add JAVAC and JAR for java
	compilation.  Add BRAINSTEM_DIR that refers to a brainstem build
	directory to be used for the robot build.

	* configure, configure.in: Prepend the arm cross-compile dir to
	PATH.  Detect java for building applets.  Add --with-brainstem to
	specify the brainstem build dir.  Add --enable-mezzanine to turn
	on the mezzanine build.

	* robots/GNUmakefile.in: Add client target that builds the
	subdirs.

	* robots/emc/GNUmakefile.in, robots/emc/emcd.h, robots/emc/emcd.c,
	test_emcd.sh.in, robots/rmcd/GNUmakefile.in, robots/rmcd/rmcd.c,
	robots/rmcd/test_rmcd.sh.in, robots/vmcd/test_vmc-client.sh.in,
	robots/vmcd/test_vmcd.sh.in, robots/vmcd/test_vmcd2.sh,
	robots/vmcd/test_vmcd3.sh, robots/vmcd/test_vmcd4.sh,
	robots/vmcd/vmc-client.c, robots/vmcd/vmcd.c: Updates for the mtp
	switch to using rpcgen.

	* robots/emc/test_emcd.config: Restore missing config line.

	* robots/mtp/GNUmakefile.in, robots/mtp/global_bound.java,
	robots/mtp/mtp.h, robots/mtp/mtp.c, robots/mtp/mtp.java,
	robots/mtp/mtp.x, robots/mtp/mtp_command_goto.java,
	robots/mtp/mtp_command_stop.java, robots/mtp/mtp_config_rmc.java,
	robots/mtp/mtp_config_vmc.java, robots/mtp/mtp_control.java,
	robots/mtp/mtp_dump.c, robots/mtp/mtp_garcia_telemetry.java,
	robots/mtp/mtp_opcode_t.java, robots/mtp/mtp_packet.java,
	robots/mtp/mtp_payload.java, robots/mtp/mtp_recv.c,
	robots/mtp/mtp_request_id.java,
	robots/mtp/mtp_request_position.java,
	robots/mtp/mtp_robot_type_t.java, robots/mtp/mtp_role_t.java,
	robots/mtp/mtp_send.c, robots/mtp/mtp_status_t.java,
	robots/mtp/mtp_telemetry.java, robots/mtp/mtp_update_id.java,
	robots/mtp/mtp_update_position.java, robots/mtp/robot_config.java,
	robots/mtp/robot_position.java, robots/mtp/test_mtp.sh: Replace
	hand-generated stubs with xdr stubs for C and java.  Java stubs
	were generated by "remotetea's" jrpcgen.

	* robots/primotion/GNUmakefile.in,
	robots/primotion/buttonManager.hh,
	robots/primotion/buttonManager.cc, robots/primotion/dashboard.hh,
	robots/primotion/dashboard.cc, robots/primotion/flash-user-led.cc,
	robots/primotion/garcia-pilot.cc, robots/primotion/garciaUtil.hh,
	robots/primotion/garciaUtil.cc, robots/primotion/ledManager.hh,
	robots/primotion/ledManager.cc,
	robots/primotion/pilotButtonCallback.hh,
	robots/primotion/pilotButtonCallback.cc,
	robots/primotion/pilotClient.hh, robots/primotion/pilotClient.cc,
	robots/primotion/watch-user-button.cc,
	robots/primotion/wheelManager.hh,
	robots/primotion/wheelManager.cc: Replace gorobot with
	garcia-pilot, a beefed up daemon for controlling the robots.
	Improvements include: making use of the user LED and button to
	give some feedback and let the wrangler run a test sequence,
	reboot, and shutdown the robot; Logging of the battery level, how
	often the robot has moved and for how long, and the distance
	traveled; telemetry is sent back to emulab clients; movements are
	now just pivot-move instead of pivot-move-pivot, since the second
	pivot ends up being extra work most of the time; the robot will
	move backwards to cut down on the amount of rotation; and just
	generic cleanups to the code.

	* robots/primotion/garcia.config: The configuration file currently
	used on the garcias.

	* www/GNUmakefile.in: Add garcia-telemetry subdir to the build.

	* www/dbdefs.php3.in: Add TBNodeClass and TBNodeStatus functions.

	* www/garcia-telemetry/Base64.java,
	www/garcia-telemetry/GNUmakefile.in,
	www/garcia-telemetry/GarciaTelemetry.java,
	www/garcia-telemetry/UpdateThread.java,
	www/garcia-telemetry/main.xml: A telemetry applet for the garcia,
	it displays readouts for the various sensors and other bits of data
	gathered by the garcia-pilot daemon.  Hopefully, it will make a
	handy debugging tool.

	* www/garcia-telemetry.jar, www/mtp.jar, www/oncrpc.jar,
	www/thinlet.jar: Java jars used by the robot telemetry applet.

	* www/servicepipe.php3: A slightly enhanced version of
	ledpipe.php3 that can be used for other services, like robot
	telemetry.

	* www/shownode.php3: Add "Show Telemetry" menu item to robot
	nodes.

	* www/telemetry.php3: Telemetry page for the garcia-telemetry
	applet.
parent 34c4029e
......@@ -62,6 +62,12 @@ vpath % $(SRCDIR) $(MOSTLY_SRCDIRS)
%.o: %.cc
$(CXX) -c -o $@ $(CXXFLAGS) $<
%_xdr.h: %.x
rpcgen -h $< > $@
%_xdr.c: %.x %_xdr.h
rpcgen -c $< > $@
#
# Rules to regen configure written files.
#
......
......@@ -4,6 +4,10 @@
# this fragment
#
# Need the PATH because the older autoconf does not support
# AC_PATH_TOOL which is needed for cross-compilation to work.
export PATH = @PATH@
export CC = @CC@
export CXX = @CXX@
export LD = @CC@ ${CFLAGS}
......@@ -11,6 +15,9 @@ export STRIP = @STRIP@
export RANLIB = @RANLIB@
export AR = @AR@
export JAVAC = @JAVAC@
export JAR = @JAR@
prefix = @prefix@
exec_prefix = @exec_prefix@
......@@ -63,3 +70,6 @@ LOG_TESTBED = @LOG_TESTBED@
EVENTSYS = @EVENTSYS@
HAVE_MEZZANINE = @HAVE_MEZZANINE@
GTK_CONFIG = @GTK_CONFIG@
BRAINSTEM_DIR = @BRAINSTEM_DIR@
host_cpu = @host_cpu@
This diff is collapsed.
......@@ -6,11 +6,30 @@ AC_CONFIG_AUX_DIR(${srcdir}/autoconf)
AC_PREFIX_DEFAULT(/usr/testbed)
AC_CONFIG_HEADER(config.h)
for tbarch in arm/3.4.1; do
PATH="/usr/local/$tbarch/bin:${PATH}"
done
if test x"${JAVA_HOME}" != x""; then
PATH="${JAVA_HOME}/bin:${PATH}"
else
for jdk in /usr/local/jdk*; do
PATH="${jdk}/bin:${PATH}"
break
done
fi
AC_SUBST(PATH)
AC_CHECK_TOOL(CC,gcc)
AC_CHECK_TOOL(CXX,g++)
AC_CHECK_TOOL(AR,ar)
AC_CHECK_TOOL(RANLIB,ranlib)
AC_CHECK_TOOL(STRIP,strip)
AC_PATH_PROG(JAVAC,javac)
AC_PATH_PROG(JAR,jar)
AC_CHECK_TOOL(SSH,ssh)
AC_SUBST(optional_subdirs)
......@@ -415,6 +434,22 @@ AC_ARG_WITH(apache-config-dir,
])
AC_SUBST(INSTALL_APACHE_CONFIG)
#
# Path to garcia installation
#
AC_ARG_WITH(brainstem,
[ --with-brainstem=<DIR> Specify the path to the brainstem installation.],
[
if test x"$withval" != x""; then
BRAINSTEM_DIR="$withval"
else
AC_MSG_ERROR([You must specify a brainstem directory]);
fi
],[
BRAINSTEM_DIR=""
])
AC_SUBST(BRAINSTEM_DIR)
#
# Optionally build with optimization or aggressive non-optimization
......@@ -508,8 +543,11 @@ AC_CHECK_HEADERS([linux/videodev.h],
HAVE_LINUX_VIDEODEV_H="yes"])
AC_CHECK_PROG(GTK_CONFIG, gtk-config, gtk-config)
AC_ARG_ENABLE(mezzanine,
[ --enable-mezzanine Enable mezzanine support])
if test x"$HAVE_LINUX_VIDEODEV_H" != x"" && test x"$GTK_CONFIG" != x""; then
HAVE_MEZZANINE="yes"
HAVE_MEZZANINE="$enable_mezzanine"
AC_DEFINE([HAVE_MEZZANINE])
else
HAVE_MEZZANINE="no"
......@@ -646,7 +684,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
utils/link_config utils/import_commitlog utils/dhcpd_wrapper \
utils/opsreboot utils/deletenode utils/webdeletenode utils/spewleds \
www/GNUmakefile www/defs.php3 www/dbdefs.php3 \
www/swish.conf www/websearch \
www/swish.conf www/websearch www/garcia-telemetry/GNUmakefile \
vis/GNUmakefile vis/webvistopology vis/dbvistopology \
vis/prerender vis/prerender_all vis/render \
vis/floormap vis/webfloormap \
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004 University of Utah and the Flux Group.
# Copyright (c) 2004, 2005 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -26,6 +26,7 @@ endif
SUBDIRS = $(MEZZDIR) mtp $(EMCDIR) vmcd primotion rmcd
all: all-subdirs
client: client-subdirs
check: check-subdirs
install: install-subdirs
......@@ -40,4 +41,3 @@ clean: clean-subdirs
%-subdirs: $(addsuffix /%.MAKE,$(SUBDIRS)) ;
.PHONY: $(SUBDIRS)
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004 University of Utah and the Flux Group.
# Copyright (c) 2004, 2005 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -15,12 +15,13 @@ PROGS = emcd loclistener
TESTS = test_emcd.sh
all: $(PROGS)
client:
include $(TESTBED_SRCDIR)/GNUmakerules
OBJS = emcd.o robot_list.o
CFLAGS += -O -g -Wall -I${OBJDIR} -I/usr/local/include
CFLAGS += -I${SRCDIR}/../mtp -I${SRCDIR}/../../event/lib
CFLAGS += -I${SRCDIR}/../mtp -I../mtp -I${SRCDIR}/../../event/lib
CFLAGS += -I${SRCDIR}/../../lib/libtb
CFLAGS += `elvin-config --cflags vin4c`
LDFLAGS = -L../mtp -L${OBJDIR}/lib/libtb -L${OBJDIR}/event/lib
......
This diff is collapsed.
......@@ -2,6 +2,8 @@
#ifndef __EMCD_H__
#define __EMCD_H__
#include "mtp.h"
struct emc_robot_config {
int id;
char *hostname;
......@@ -11,12 +13,12 @@ struct emc_robot_config {
};
struct rmc_client {
int sock_fd;
mtp_handle_t handle;
struct robot_list *position_list;
};
struct vmc_client {
int sock_fd;
mtp_handle_t handle;
struct robot_list *position_list;
};
......
1 garcia1.flux.utah.edu 0 0 0.00 node1
2 garcia2.flux.utah.edu 0 0 0.00 node2
......@@ -45,34 +45,34 @@ 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 76; version 1; role 0
Packet: version 2; role emc
opcode: config-rmc
num: 2
horiz: 3.657600
vert: 2.438400
horiz: 0.000000
vert: 0.000000
robot[0]: 1, garcia1.flux.utah.edu
robot[1]: 2, garcia2.flux.utah.edu
Packet: length 44; version 1; role 0
Packet: version 2; role emc
opcode: error
id: -1
code: -1
id: 0
code: 0
msg: position not updated yet
EOF
run_test ../mtp/mtp_send -n localhost -P ${PORT} \
-w -r rmc -i 0 -c 0 -m "empty" init -- \
-r rmc -i 1 -x 6 -y 7 -o 0.44 -s idle -t 1 update-position -- \
-r rmc -i 1 -x 6 -y 7 -o 0.44 -s complete -t 1.0 update-position -- \
-w -r rmc -i 1 request-position
check_output "init -> update-position -> request-position failed?" <<EOF
Packet: length 76; version 1; role 0
Packet: version 2; role emc
opcode: config-rmc
num: 2
horiz: 3.657600
vert: 2.438400
horiz: 0.000000
vert: 0.000000
robot[0]: 1, garcia1.flux.utah.edu
robot[1]: 2, garcia2.flux.utah.edu
Packet: length 36; version 1; role 0
Packet: version 2; role emc
opcode: update-position
id: 1
x: 6.000000
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004 University of Utah and the Flux Group.
# Copyright (c) 2004, 2005 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -12,27 +12,36 @@ SUBDIR = robots/mtp
include $(OBJDIR)/Makeconf
MTPLIBS = libmtp.a
MTPPROGS = mtp_test mtp_send mtp_recv mtp_dump
MTPPROGS = mtp_send mtp_recv mtp_dump
TESTS = test_mtp.sh
TESTS = mtp_test
ifeq ($(JAVAC),)
JARS =
else
JARS = $(TESTBED_SRCDIR)/www/mtp.jar
endif
all: $(MTPLIBS) $(MTPPROGS)
all client: $(MTPLIBS) $(MTPPROGS) $(JARS)
include $(TESTBED_SRCDIR)/GNUmakerules
OBJS = mtp.o
CFLAGS += -O -g -Wall -I${OBJDIR} -I/usr/local/include
OBJS = mtp.o mtp_xdr.o
CFLAGS += -O -g -Wall -I. -I${SRCDIR} -I${OBJDIR} -I/usr/local/include
libmtp.a: $(OBJS)
$(AR) crv $@ $<
$(AR) crv $@ $^
$(RANLIB) $@
mtp.o: mtp.h
mtp.h: mtp_xdr.h
mtp.o: mtp.h mtp_xdr.o
mtp_test.o: mtp.h
mtp_send.o: mtp.h
mtp_recv.o: mtp.h
mtp_dump.o: mtp.h
test_mtp.sh: mtp_send mtp_recv
mtp_test: mtp_test.o $(MTPLIBS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ mtp_test.o -L. -lmtp
......@@ -45,6 +54,16 @@ mtp_recv: mtp_recv.o $(MTPLIBS)
mtp_dump: mtp_dump.o $(MTPLIBS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ mtp_dump.o -L. -lmtp
CLASSES_SRC = $(wildcard $(SRCDIR)/*.java)
CLASSES = $(patsubst $(SRCDIR)/%.java,net/emulab/%.class,$(CLASSES_SRC))
$(CLASSES): $(CLASSES_SRC)
env CLASSPATH=$(TESTBED_SRCDIR)/www/oncrpc.jar:. $(JAVAC) -d . $^
$(TESTBED_SRCDIR)/www/mtp.jar: $(CLASSES)
$(JAR) cvf $@ $^
install: all
-mkdir -p $(INSTALL_DIR)/opsdir/bin
$(INSTALL_PROGRAM) mtp_send $(INSTALL_DIR)/opsdir/bin/mtp_send
......@@ -52,4 +71,4 @@ install: all
$(INSTALL_PROGRAM) mtp_dump $(INSTALL_DIR)/opsdir/bin/mtp_dump
clean:
/bin/rm -f *.o *.a $(MTPPROGS)
/bin/rm -f *.o *.a $(MTPPROGS) mtp_xdr.h mtp_xdr.c $(CLASSES)
/*
* Automatically generated by jrpcgen 1.0.5 on 1/8/05 2:03 PM
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
* See http://acplt.org/ks/remotetea.html for details
*/
package net.emulab;
import org.acplt.oncrpc.*;
import java.io.IOException;
public class global_bound implements XdrAble {
public float horizontal;
public float vertical;
public global_bound() {
}
public global_bound(XdrDecodingStream xdr)
throws OncRpcException, IOException {
xdrDecode(xdr);
}
public void xdrEncode(XdrEncodingStream xdr)
throws OncRpcException, IOException {
xdr.xdrEncodeFloat(horizontal);
xdr.xdrEncodeFloat(vertical);
}
public void xdrDecode(XdrDecodingStream xdr)
throws OncRpcException, IOException {
horizontal = xdr.xdrDecodeFloat();
vertical = xdr.xdrDecodeFloat();
}
}
// End of global_bound.java
This diff is collapsed.
This diff is collapsed.
/*
* Automatically generated by jrpcgen 1.0.5 on 1/8/05 2:03 PM
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
* See http://acplt.org/ks/remotetea.html for details
*/
package net.emulab;
import org.acplt.oncrpc.*;
import java.io.IOException;
/**
* A collection of constants used by the "mtp" ONC/RPC program.
*/
public interface mtp {
public static final int FOO = 0x20049679;
public static final int FIRST_DEMO_VERSION = 1;
public static final int NULL_1 = 0;
public static final int MTP_VERSION = 0x02;
}
// End of mtp.java
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2005 University of Utah and the Flux Group.
* All rights reserved.
*/
/**
* @file mtp.x
*
* XDR specification for the data structures used in the MTP protocol. This
* file will be fed into rpcgen(1) to create "mtp_xdr.h" and "mtp_xdr.c".
*/
#ifdef RPC_HDR
%#include <rpc/types.h>
%#include <rpc/xdr.h>
%
%#ifdef __cplusplus
%extern "C" {
%#endif
#endif
/**
* Current version number for the protocol.
*
* @see mtp_packet
*/
const MTP_VERSION = 0x02;
/**
* Opcodes for each message type.
*
* @see mtp_payload
*/
enum mtp_opcode_t {
/**
* An error message.
*/
MTP_CONTROL_ERROR = 11,
/**
* Unused.
*/
MTP_CONTROL_NOTIFY = 12,
/**
* Initialize a client connection with a server.
*/
MTP_CONTROL_INIT = 13,
/**
* Unused.
*/
MTP_CONTROL_CLOSE = 14,
/**
* VMC configuration packet, sent in response to an MTP_CONTROL_INIT.
*/
MTP_CONFIG_VMC = 20,
/**
* RMC configuration packet, sent in response to an MTP_CONTROL_INIT.
*/
MTP_CONFIG_RMC = 21,
/**
* Request the current position of a given robot.
*/
MTP_REQUEST_POSITION = 30,
/**
* Request the identity of a robot at a given position.
*/
MTP_REQUEST_ID = 31,
/**
* Update the current position of a robot, can be sent in response to an
* MTP_REQUEST_POSITION or spontaneously.
*/
MTP_UPDATE_POSITION = 40,
/**
* Update the identity of a robot at a position, sent in response to an
* MTP_REQUEST_ID.
*/
MTP_UPDATE_ID = 41,
/**
* Move the robot to a specific position or orientation.
*/
MTP_COMMAND_GOTO = 50,
/**
* Stop the robot from moving any further.
*/
MTP_COMMAND_STOP = 51,
/**
* Telemetry from a robot.
*/
MTP_TELEMETRY = 60,
MTP_OPCODE_MAX
};
/**
* The "role" of the daemon that is sending a packet.
*
* @see mtp_packet
*/
enum mtp_role_t {
MTP_ROLE_VMC = 1,
MTP_ROLE_EMC = 2,
MTP_ROLE_RMC = 3,
MTP_ROLE_EMULAB = 4,
MTP_ROLE_ROBOT = 5,
MTP_ROLE_MAX
};
/**
* The status of the robot whose position is being updated.
*
* @see mtp_update_position
*/
enum mtp_status_t {
MTP_POSITION_STATUS_UNKNOWN = -1,
MTP_POSITION_STATUS_IDLE = 1,
MTP_POSITION_STATUS_MOVING = 2,
MTP_POSITION_STATUS_ERROR = 3,
MTP_POSITION_STATUS_COMPLETE = 4,
MTP_POSITION_STATUS_OBSTRUCTED = 5,
MTP_POSITION_STATUS_ABORTED = 6,
MTP_POSITION_STATUS_CYCLE_COMPLETE = 32
};
struct mtp_control {
int id;
int code;
string msg<>;
};
struct robot_config {
int id;
string hostname<>;
};
struct global_bound {
float horizontal;
float vertical;
};
struct mtp_config_rmc {
robot_config robots<>;
global_bound box;
};
struct mtp_config_vmc {
robot_config robots<>;
};
struct mtp_request_position {
int robot_id;
};
struct robot_position {
float x;
float y;
float theta;
double timestamp;
};
struct mtp_update_position {
int robot_id;
robot_position position;
mtp_status_t status;
};
struct mtp_request_id {
int request_id;
robot_position position;
};
struct mtp_update_id {
int request_id;
int robot_id;
};
struct mtp_command_goto {
int command_id;
int robot_id;
robot_position position;
};
struct mtp_command_stop {
int command_id;
int robot_id;
};
/**
* The different types of robots that support telemetry.
*/
enum mtp_robot_type_t {
MTP_ROBOT_GARCIA = 1 /*< Acroname Garcia. */
};
struct mtp_garcia_telemetry {
float battery_level;
float battery_voltage;
int battery_misses;
float left_odometer;
float right_odometer;
float left_instant_odometer;
float right_instant_odometer;
float left_velocity;
float right_velocity;
unsigned int move_count;
int move_time_sec;
int move_time_usec;
int down_ranger_left;
int down_ranger_right;
float front_ranger_left;
float front_ranger_right;
float front_ranger_threshold;
float rear_ranger_left;
float rear_ranger_right;
float rear_ranger_threshold;
float side_ranger_left;
float side_ranger_right;
float side_ranger_threshold;
float speed;
int status;
int idle;
int user_button;
int user_led;
};
union mtp_telemetry switch (mtp_robot_type_t type) {
case MTP_ROBOT_GARCIA: mtp_garcia_telemetry garcia;
};
union mtp_payload switch (mtp_opcode_t opcode) {
case MTP_CONTROL_ERROR: mtp_control error;
case MTP_CONTROL_NOTIFY: mtp_control notify;
case MTP_CONTROL_INIT: mtp_control init;
case MTP_CONTROL_CLOSE: mtp_control close;
case MTP_CONFIG_RMC: mtp_config_rmc config_rmc;
case MTP_CONFIG_VMC: mtp_config_vmc config_vmc;
case MTP_REQUEST_POSITION: mtp_request_position request_position;
case MTP_REQUEST_ID: mtp_request_id request_id;
case MTP_UPDATE_POSITION: mtp_update_position update_position;
case MTP_UPDATE_ID: mtp_update_id update_id;
case MTP_COMMAND_GOTO: mtp_command_goto command_goto;
case MTP_COMMAND_STOP: mtp_command_stop command_stop;
case MTP_TELEMETRY: mtp_telemetry telemetry;
};
/**
* The packet structure used for the MTP protocol, contains a simple header and
* the payload with the actual message data.
*/
struct mtp_packet {
short vers;
short role;
mtp_payload data;
};
#ifdef JAVA_RPC
program FOO {
version FIRST_DEMO_VERSION {
void nullcall(void) = 0;
} = 1;
} = 0x20049679;
#endif
#ifdef RPC_HDR
%#ifdef __cplusplus