Permalink
Browse files

Merge branch 'cleanups' into lines

  • Loading branch information...
2 parents cea1b1b + aac90c5 commit 1ea8d802f70cce5adb2599732dd09449173a51bf @chachi chachi committed Jan 3, 2010
View
@@ -37,6 +37,6 @@ noggin/util/fakeData/*
/motion/README.log
/motion/README.toc
/motion/README.pdf
-docs*/
+docs*
/noggin/offline/c++filt
/noggin/offline/faker
View
@@ -21,6 +21,7 @@ CROSS_TOOLCHAIN = $(abspath $(CURDIR)/cmake/geode.cmake)
CMAKE_DEFS = -DOE_CROSS_BUILD=OFF -DSTRAIGHT=ON
CMAKE_CROSS_DEFS = -DCMAKE_TOOLCHAIN_FILE=$(CROSS_TOOLCHAIN) -DOE_CROSS_BUILD=ON
CMAKE_WEBOTS_DEFS = -DOE_CROSS_BUILD=OFF -DMAN_IS_REMOTE_=ON -DWEBOTS_BACKEND=ON -DCOLOR_TABLE=tables/webots.mtb
+CCMAKE_CROSS_OPT = -DCMAKE_SHARED_LINKER_FLAGS:STRING="" -DCMAKE_MODULE_LINKER_FLAGS:STRING=""
TRUNK_REVISION = r0# $(shell svn info | grep Revision | awk 'FS=" " {print $$2}')
export TRUNK_REVISION
@@ -70,7 +71,7 @@ $(STRAIGHT_FILE):
cross: $(CROSS_FILE)
@set -e ; \
$(CD) $(BUILD_DIR); \
- $(CCMAKE) .
+ $(CCMAKE) $(CCMAKE_CROSS_OPT) .
$(CROSS_FILE):
@if [ -e $(STRAIGHT_FILE) ] || [ -e $(WEBOTS_FILE) ]; then \
View
@@ -88,6 +88,7 @@ Man::Man (shared_ptr<Sensors> _sensors,
noggin = shared_ptr<Noggin>(new Noggin(profiler,vision,comm,guardian,
sensors, motion->getInterface()));
#endif// USE_NOGGIN
+ PROF_ENTER(profiler.get(), P_GETIMAGE);
}
Man::~Man ()
@@ -166,9 +167,10 @@ Man::processFrame ()
//if(camera_active)
//vision->copyImage(sensors->getImage());
#endif
- PROF_EXIT(profiler.get(), P_GETIMAGE);
+
PROF_ENTER(profiler.get(), P_FINAL);
+ PROF_EXIT(profiler.get(), P_GETIMAGE);
#ifdef USE_VISION
//if(camera_active)
vision->notifyImage(sensors->getImage());
@@ -183,16 +185,16 @@ Man::processFrame ()
lights->sendLights();
PROF_EXIT(profiler.get(), P_LIGHTS);
+ PROF_ENTER(profiler.get(), P_GETIMAGE);
PROF_EXIT(profiler.get(), P_FINAL);
PROF_NFRAME(profiler.get());
-
- PROF_ENTER(profiler.get(), P_GETIMAGE);
}
void Man::notifyNextVisionImage() {
// Synchronize noggin's information about joint angles with the motion
// thread's information
+
sensors->updateVisionAngles();
transcriber->postVisionSensors();
View
@@ -150,7 +150,7 @@ SET( ROBOT_NAME ${@ROBOT_NAME@} )
############################ COLOR TABLE SELECTION
# Set the path to the color table you wish to be loaded into install/etc
SET( COLOR_TABLE
- "tables/lab120/joho850.mtb"
+ "tables/lab120/jack800.mtb"
CACHE STRING
"Path relative to man directory for the desired color table"
)
@@ -4,6 +4,7 @@
# The basic diefinitions for the Northern Bites cmake packages, used
# throughout different packages' configurations
+cmake_policy(SET CMP0011 OLD)
############################ TRUNK PATH
# Ensure the TRUNK_PATH variable is set
View
@@ -466,6 +466,10 @@ void Comm::run ()
running = true;
trigger->on();
+ struct timespec interval, remainder;
+ interval.tv_sec = 0;
+ interval.tv_nsec = SLEEP_MILLIS * 1000;
+
try {
bind();
@@ -476,7 +480,7 @@ void Comm::run ()
while (running && !timer.time_for_packet()) {
receive();
- usleep(SLEEP_MILLIS);
+ nanosleep(&interval, &remainder);
}
}
}catch (socket_error &e) {
@@ -703,13 +707,17 @@ void Comm::send (const char *msg, int len, sockaddr_in &addr) throw(socket_error
// send the udp message
int result = -2;
+ struct timespec interval, remainder;
+ interval.tv_sec = 0;
+ interval.tv_nsec = 100000;
+
while (result == -2) {
result = ::sendto(sockn, msg, len, 0, (struct sockaddr*)&addr,
sizeof(broadcast_addr));
// except if error is blocking error
if (result == -1 && errno == EAGAIN) {
result = -2;
- usleep(100);
+ nanosleep(&interval, &remainder);
}
}
View
@@ -40,6 +40,7 @@ void ALEnactor::run() {
Thread::trigger->on();
long long currentTime;
+ struct timespec interval, remainder;
while (running) {
currentTime = micro_time();
sendCommands();
@@ -55,8 +56,10 @@ void ALEnactor::run() {
<< processTime <<endl;
//Don't sleep at all
} else{
- usleep(static_cast<useconds_t>(MOTION_FRAME_LENGTH_uS
- - static_cast<float>(processTime)));
+ interval.tv_sec = 0;
+ interval.tv_nsec = static_cast<long long int>(MOTION_FRAME_LENGTH_uS
+ - static_cast<float>(processTime));
+ nanosleep(&interval,&remainder);
}
#endif
@@ -55,6 +55,8 @@ void ALImageTranscriber::run() {
Thread::trigger->on();
long long lastProcessTimeAvg = VISION_FRAME_LENGTH_uS;
+
+ struct timespec interval, remainder;
while (Thread::running) {
//start timer
const long long startTime = micro_time();
@@ -74,12 +76,15 @@ void ALImageTranscriber::run() {
<< " frame length: " << processTime <<endl;
//Don't sleep at all
} else{
- // cout << "Sleeping for " << VISION_FRAME_LENGTH_uS
- // -processTime << endl;
+ //cout << "Sleeping for " << VISION_FRAME_LENGTH_uS
+ //-processTime << endl;
+
+ //nanosleep(10000000);
+ interval.tv_sec = 0;
+ interval.tv_nsec = static_cast<long long int>((VISION_FRAME_LENGTH_uS
+ -processTime) * 1000);
- //usleep(10000000);
- usleep(static_cast<useconds_t>(VISION_FRAME_LENGTH_uS
- -processTime));
+ nanosleep(&interval, &remainder);
}
}
Thread::trigger->off();
View
@@ -83,6 +83,9 @@ void RoboGuardian::run(){
Thread::running = true;
Thread::trigger->on();
+ struct timespec interval, remainder;
+ interval.tv_sec = 0;
+ interval.tv_nsec = static_cast<long long int>(GUARDIAN_FRAME_LENGTH_uS * 1000);
while(Thread::running){
countButtonPushes();
@@ -92,7 +95,7 @@ void RoboGuardian::run(){
checkTemperatures();
processFallingProtection();
processChestButtonPushes();
- usleep(static_cast<useconds_t>(GUARDIAN_FRAME_LENGTH_uS));
+ nanosleep(&interval, &remainder);
}
Thread::trigger->off();
View
@@ -1,7 +1,8 @@
#include "AbstractGait.h"
#include <iostream>
-#include <string.h>
+#include "string.h"
+#include "stdio.h"
using namespace std;
AbstractGait::AbstractGait(){}
AbstractGait::~AbstractGait(){}
@@ -0,0 +1,32 @@
+#
+# Defines states for SweetMove testing
+#
+
+import man.motion.SweetMoves as SweetMoves
+
+def gameInitial(player):
+ player.gainsOn()
+ return player.stay()
+
+def gameReady(player):
+ return player.goLater('doMove')
+def gameSet(player):
+ return player.goLater('doMove')
+def gamePlaying(player):
+ return player.goLater('doMove')
+def gamePenalized(player):
+ return player.goLater('doMove')
+
+def doMove(player):
+ if player.firstFrame():
+ player.gainsOn()
+ player.executeMove(SweetMoves.ZERO_POS)
+
+ if player.counter == 1:
+ return player.goLater('done')
+ return player.stay()
+
+def done(player):
+ if player.firstFrame():
+ return player.stay()
+ return player.stay()
View
@@ -0,0 +1,15 @@
+#
+# A behavior to test SweetMoves.
+#
+
+from . import SoccerFSA
+from . import SweetStates
+
+class SoccerPlayer(SoccerFSA.SoccerFSA):
+ def __init__(self, brain):
+ SoccerFSA.SoccerFSA.__init__(self,brain)
+ self.addStates(SweetStates)
+ self.setName('pSweet')
+ # No fall protection when testing sweetMoves
+ brain.roboguardian.enableFallProtection(False)
+
View
@@ -0,0 +1,39 @@
+#!/bin/sh
+###############################################################################
+# This script will setup auto-login into a remote machine. Specifically,
+# this is is useful for seting up auto-login for the Naos.
+# Instructions filtched from http://linuxproblem.org/art_9.html
+#
+# NOTE: If you run this script twice on the same robot, your hostname will
+# appear twice in .ssh/authorized_keys. Login will still work, but you will
+# bloat the file
+#
+# jstrom, June 2008
+#
+##############################################################################
+
+REMOTE_USERNAME=root
+SSH=~/.ssh
+ID_RSA_FILE=$SSH/id_rsa
+RSA_PUBLIC_KEY_FILE=$SSH/id_rsa.pub
+
+if [ "$1" == "" ]; then
+ echo "Usage: ./setup-autologin <robot-ip>"
+ exit 1
+fi
+
+echo "Configuring auto login. Only run this once per robot "
+
+
+if [ ! -e $RSA_PUBLIC_KEY_FILE ] || [ ! -e $ID_RSA_FILE ]; then
+ echo "Generating a public key"
+ ssh-keygen -t rsa -N "" -f $ID_RSA_FILE
+else
+ echo "Detected an exisiting public key, so won't generate a new one"
+fi
+
+echo "Configuring remote robot with your public key."
+echo "Please enter the password for the robot when promted:"
+cat $RSA_PUBLIC_KEY_FILE | ssh $REMOTE_USERNAME@$1 'mkdir -p .ssh && cat >> .ssh/authorized_keys'
+
+echo "setup complete"
@@ -14,6 +14,7 @@ class VisualFieldObject;
#include "VisionStructs.h"
#include "VisionHelpers.h"
#include "Blob.h"
+#include "stdio.h"
// This class should eventually inheret from VisualLandmark, once it is
// cleaned a bit

0 comments on commit 1ea8d80

Please sign in to comment.