Ejemplo n.º 1
0
/* Reset the position and other variables in each finger */
void Hand::reset() {
  for (int i = 0; i < NUM_FINGERS; i++) {
    finger[i].close();

    delay(3000);

    finger[i].stop();

    printPos();

    finger[i].reset();

    delay(500);

    finger[i].current_grasp = OPEN;

    finger[i].setTarget(graspToTarget(finger[i].current_grasp, i));

    for (int j = 0; j < 30; j++) {
      finger[i].update();
      delay(50);
    }

    finger[i].stop();

    printPos();

    finger[i].current_grasp = NIL;
    finger[i].setTarget(graspToTarget(finger[i].current_grasp, i));
  }
}
Ejemplo n.º 2
0
int main(int argc, char *argv[]) 
{
	int c=1;
	construct();
	while(c!=0)
	{
		menu();
		scanf("%d",&c);
		if(c==1)
			insert();
		else if(c==2)
			remve();
		else if(c==3)
			peek();
		else if(c==4)
			printHeap();
		else if(c==5)
			printSize();
		else if(c==6)
			printPos();
		else if(c==7)
			c=0;
	}
	return 0;
}
Ejemplo n.º 3
0
 void print( const PlayerT & player )
   {
       if ( player.state_ )
       {
           std::cout << "<Player side=\"" << player.side_ << "\"";
           std::cout << " unum=\"" << player.unum_ << "\"";
           std::cout << " type=\"" << player.type_ << "\"";
           if ( player.state_ != 1 ) std::cout << " mode=\"" << player.state_ << "\"";
           std::cout << ">\n";
           printPos( player.x_,  player.y_ );
           printVel( player.vx_, player.vy_ );
           printAngles( player.body_, player.neck_ );
           printView( player.view_width_, player.view_quality_ == 'h' );
           printStamina( player.stamina_, player.effort_, player.recovery_ );
           printCounts( player.kick_count_,
                        player.dash_count_,
                        player.turn_count_,
                        player.say_count_,
                        player.turn_neck_count_,
                        player.catch_count_,
                        player.move_count_,
                        player.change_view_count_ );
           std::cout << "</Player>\n";
       }
   }
Ejemplo n.º 4
0
void Moveable::zPos(double z) 
{ 
    zPos_(z); 
    if (globReportFlag)
        printPos();
    flag_ = true;
}
Ejemplo n.º 5
0
 void print( const BallT & ball )
   {
       std::cout << "<Ball>\n";
       printPos( ball.x_,  ball.y_ );
       printVel( ball.vx_, ball.vy_ );
       std::cout << "</Ball>\n";
   }
Ejemplo n.º 6
0
void Moveable::yPos(double y) 
{ 
    yPos_(y); 
    if (globReportFlag)
        printPos();
    flag_ = true;
}
Ejemplo n.º 7
0
void Moveable::xPos(double x) 
{ 
    xPos_(x);
    if (globReportFlag)
        printPos();
    flag_ = true;
}
Ejemplo n.º 8
0
void doPeakClusters(struct trackDb *tdb, char *item)
/* Display detailed info about a cluster of DNase peaks from other tracks. */
{
int start = cartInt(cart, "o");
char *table = tdb->table;
int rowOffset = hOffsetPastBin(database, seqName, table);
char query[256];
struct sqlResult *sr;
char **row;
struct bed *cluster = NULL;
struct sqlConnection *conn = hAllocConn(database);

cartWebStart(cart, database, "%s item details", tdb->shortLabel);
sqlSafef(query, sizeof(query),
	"select * from %s where  name = '%s' and chrom = '%s' and chromStart = %d",
	table, item, seqName, start);
sr = sqlGetResult(conn, query);
row = sqlNextRow(sr);
if (row != NULL)
    cluster = bedLoadN(row+rowOffset, 5);
sqlFreeResult(&sr);

if (cluster != NULL)
    {
    /* Get list of subgroups to display */
    char *inputTableFieldDisplay = trackDbSetting(tdb, "inputTableFieldDisplay");
    if (inputTableFieldDisplay != NULL)
        {
	struct slName *fieldList = stringToSlNames(inputTableFieldDisplay);
	char *inputTrackTable = trackDbRequiredSetting(tdb, "inputTrackTable");

	/* Print out some information about the cluster overall. */
	printf("<B>Items in Cluster:</B> %s of %d<BR>\n", cluster->name, 
	    sqlRowCount(conn, sqlCheckIdentifier(inputTrackTable)));
	printf("<B>Cluster Score (out of 1000):</B> %d<BR>\n", cluster->score);
	printPos(cluster->chrom, cluster->chromStart, cluster->chromEnd, NULL, TRUE, NULL);

	/* In a new section put up list of hits. */
	webNewSection("List of Items in Cluster");
	webPrintLinkTableStart();
	printClusterTableHeader(fieldList, FALSE, FALSE, TRUE);
	printPeakClusterInfo(tdb, cart, conn, inputTrackTable, fieldList, cluster);
	}
    else
	errAbort("Missing required trackDb setting %s for track %s",
	    "inputTableFieldDisplay", tdb->track);
    webPrintLinkTableEnd();
    }
printf("<A HREF=\"%s&g=htcListItemsAssayed&table=%s\" TARGET_blank>", hgcPathAndSettings(),
	tdb->track);
printf("List all items assayed");
printf("</A><BR>\n");
webNewSection("Track Description");
printTrackHtml(tdb);
hFreeConn(&conn);
}
Ejemplo n.º 9
0
void Finger::printDetails(void)
{
    MYSERIAL.print("Finger ");
    MYSERIAL.print(fingerIndex);
    MYSERIAL.print("  ");
    printSpeed();
    printPos();
    printDir();
    printReached(true);		// print new line after

}
Ejemplo n.º 10
0
int PlayListWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QTreeWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: playListEmpty(); break;
        case 1: playItem((*reinterpret_cast< PlayListItem*(*)>(_a[1]))); break;
        case 2: addFile((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 3: addFile((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 4: addFile((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QMap<QString,QString>(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break;
        case 5: addFile((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QMap<QString,QString>(*)>(_a[2]))); break;
        case 6: { int _r = addDir((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])));
            if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; }  break;
        case 7: { int _r = addDir((*reinterpret_cast< QString(*)>(_a[1])));
            if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; }  break;
        case 8: removeSelected(); break;
        case 9: doubleClicked((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 10: scrollToActive(); break;
        case 11: deselect((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 12: clearPlayList(); break;
        case 13: { int _r = loadM3UPlayList((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])));
            if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; }  break;
        case 14: { int _r = loadM3UPlayList((*reinterpret_cast< QString(*)>(_a[1])));
            if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; }  break;
        case 15: { int _r = loadPLSPlayList((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])));
            if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; }  break;
        case 16: { int _r = loadPLSPlayList((*reinterpret_cast< QString(*)>(_a[1])));
            if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; }  break;
        case 17: saveM3UPlayList((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 18: savePLSPlayList((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 19: updateColumnWidth((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break;
        case 20: updateColumnPosition((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break;
        case 21: headerContextMenu((*reinterpret_cast< const QPoint(*)>(_a[1]))); break;
        case 22: setScroll(); break;
        case 23: hideSection(); break;
        case 24: showSection(); break;
        case 25: printPos((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 26;
    }
    return _id;
}
Ejemplo n.º 11
0
void BinTree<T>::printPos() {
    printPos(m_pRoot);
    cout << endl;
}
Ejemplo n.º 12
0
void Finger::printPos(void)
{
    printPos(0);
}
Ejemplo n.º 13
0
void AVL_tree<T>::printPos() {
    printPos(m_pRoot);
    cout << endl;
}
Ejemplo n.º 14
0
void AVL_tree<T>::printPos(Node_T *p) {
    if(!p)  return;
    if(p->m_pChildren[0])   printPos(p->m_pChildren[0]);
    if(p->m_pChildren[1])   printPos(p->m_pChildren[1]);
    printElem(p);
}
Ejemplo n.º 15
0
void doFactorSource(struct sqlConnection *conn, struct trackDb *tdb, char *item, int start, int end)
/* Display detailed info about a cluster of TFBS peaks from other tracks. */
{
char extraWhere[256];
safef(extraWhere, sizeof extraWhere, "name='%s'", item);
int rowOffset;
struct sqlResult *sr = hRangeQuery(conn, tdb->table, seqName, start, end, extraWhere, &rowOffset);
char **row = sqlNextRow(sr);
struct factorSource *cluster = NULL;
if (row != NULL)
    cluster = factorSourceLoad(row + rowOffset);
sqlFreeResult(&sr);

if (cluster == NULL)
    errAbort("Error loading cluster from track %s", tdb->track);

char *sourceTable = trackDbRequiredSetting(tdb, "sourceTable");

char *factorLink = cluster->name;
char *vocab = trackDbSetting(tdb, "controlledVocabulary");
if (vocab != NULL)
    {
    char *file = cloneFirstWord(vocab);
    factorLink = wgEncodeVocabLink(file, "term", factorLink, factorLink, factorLink, "");
    }
printf("<B>Factor:</B> %s<BR>\n", factorLink);
printf("<B>Cluster Score (out of 1000):</B> %d<BR>\n", cluster->score);
printPos(cluster->chrom, cluster->chromStart, cluster->chromEnd, NULL, TRUE, item);

/* Get list of tracks we'll look through for input. */
char *inputTrackTable = trackDbRequiredSetting(tdb, "inputTrackTable");
char query[256];
sqlSafef(query, sizeof(query), "select tableName from %s where factor='%s' order by source", 
                inputTrackTable, 
    cluster->name);

/* Next do the lists of hits and misses.  We have the hits from the non-zero signals in
 * cluster->expScores.  We need to figure out the sources actually assayed though
 * some other way.  We'll do this by one of two techniques. */
char *inputTableFieldDisplay = trackDbSetting(tdb, "inputTableFieldDisplay");
if (inputTableFieldDisplay != NULL)
    {
    struct slName *fieldList = stringToSlNames(inputTableFieldDisplay);
    char *vocab = trackDbSetting(tdb, "controlledVocabulary");

    /* In a new section put up list of hits. */
    webNewSection("Assays for %s in Cluster", cluster->name);
    webPrintLinkTableStart();
    printClusterTableHeader(fieldList, TRUE, FALSE, TRUE);
    printFactorSourceTableHits(cluster, conn, sourceTable, 
            inputTrackTable, fieldList, FALSE, vocab);
    webPrintLinkTableEnd();

    webNewSectionHeaderStart();
    char sectionTitle[128];
    safef(sectionTitle, 
            sizeof(sectionTitle),"Assays for %s Without Hits in Cluster", cluster->name);
    jsBeginCollapsibleSectionOldStyle(cart, tdb->track, "cellNoHits", sectionTitle, FALSE);
    webNewSectionHeaderEnd();
    webPrintLinkTableStart();
    printClusterTableHeader(fieldList, TRUE, FALSE, FALSE);
    printFactorSourceTableHits(cluster, conn, sourceTable, 
            inputTrackTable, fieldList, TRUE, vocab);
    webPrintLinkTableEnd();
    jsEndCollapsibleSection();
    }
else
    {
    errAbort("Missing required trackDb setting %s for track %s",
        "inputTableFieldDisplay", tdb->track);
    }
webNewSectionHeaderStart();
jsBeginCollapsibleSectionOldStyle(cart, tdb->track, "cellSources", "Cell Abbreviations", FALSE);
webNewSectionHeaderEnd();
hPrintFactorSourceAbbrevTable(conn, tdb);
jsEndCollapsibleSection();

doClusterMotifDetails(conn, tdb, cluster);
}
Ejemplo n.º 16
0
int main(int argc, const char **argv)
{
	double  actual_result_trans;
	double  actual_result_angle;
	int finished;
	playerc_client_t *client;
	playerc_position2d_t *position2d;
	playerc_bumper_t * bumper;
	
	// Create a client object and connect to the server
	client = playerc_client_create(NULL, SERVER, PORT);
	if (playerc_client_connect(client) != 0)
	{
		fprintf(stderr, "error: %s\n", playerc_error_str());
		return -1;
	}
	printf("Connected...");
	
	// Create a position2d proxy (device id "position2d:0") and susbscribe
	// in read/write mode
	position2d = playerc_position2d_create(client, 0);
	if (playerc_position2d_subscribe(position2d, PLAYERC_OPEN_MODE))
	{
		fprintf(stderr, "error: %s\n", playerc_error_str());
		return -1;
	}
	printf("Position2D Subscribed...");
	
	//Creates a Bumper Device Proxy
	bumper = playerc_bumper_create(client, 0);
	if(playerc_bumper_subscribe(bumper, PLAYERC_OPEN_MODE)) {
		fprintf(stderr, "error: %s\n", playerc_error_str());
		return -1;
	}
	printf("Bumper Subscribed...");
	
	// Enable the robots motors
	playerc_position2d_enable(position2d, 1);
	printf("Motor Enabled\n");
	

	
#ifdef ABSOLUTE_COORD
	//calls our move function to move to second point
	actual_result_trans = Move(client,position2d,bumper,3.2,0.0);
	printf("Results Returned from Move: %f\n",actual_result_trans);
	printPos(client,position2d,bumper);
	
	//rotates robot into position for third point
	actual_result_angle = Turn(client,position2d,bumper,(PI/2.0));
	printf("Results Returned from TurnL %f\n",actual_result_angle);
	printPos(client,position2d,bumper);
	
	//moves to third point from second point
	actual_result_trans = Move(client,position2d,bumper,3.2,3.04);
	printf("Results Returned from Move: %f\n",actual_result_trans);
	printPos(client,position2d,bumper);
	
	//rotates robot into position for the fourth point
	actual_result_angle = Turn(client,position2d,bumper,2.75741633);
	printf("Results Returned from TurnL %f\n",actual_result_angle);
	printPos(client,position2d,bumper);
	
	//moves to fouth point from third point
	actual_result_trans = Move(client,position2d,bumper,-0.5,4.7);
	printf("Results Returned from Move: %f\n",actual_result_trans);
	printPos(client,position2d,bumper);
	
	//rotates robot into position for point five
	actual_result_angle = Turn(client,position2d,bumper,(PI/2.0));
	printf("Results Returned from TurnL %f\n",actual_result_angle);
	printPos(client,position2d,bumper);
	
	//moves robot from position four to position five
	actual_result_trans = Move(client,position2d,bumper,-0.55,11.6);
	printf("Results Returned from Move: %f\n",actual_result_trans);
	printPos(client,position2d,bumper);
#else
	//calls our move function to move to second point
	actual_result_trans = Move(client,position2d,bumper,3.2,0.0);
	printf("Results Returned from Move: %f\n",actual_result_trans);
	printPos(client,position2d,bumper);
	
	//rotates robot into position for third point
	actual_result_angle = Turn(client,position2d,bumper,(PI/2.0));
	printf("Results Returned from TurnL %f\n",actual_result_angle);
	printPos(client,position2d,bumper);
	
	//moves to third point from second point
	actual_result_trans = Move(client,position2d,bumper,3.04,0.0);
	printf("Results Returned from Move: %f\n",actual_result_trans);
	printPos(client,position2d,bumper);
	
	//rotates robot into position for the fourth point
	actual_result_angle = Turn(client,position2d,bumper,1.18662);
	printf("Results Returned from TurnL %f\n",actual_result_angle);
	printPos(client,position2d,bumper);
	
	//moves to fouth point from third point
	actual_result_trans = Move(client,position2d,bumper,4.02,0.0);
	printf("Results Returned from Move: %f\n",actual_result_trans);
	printPos(client,position2d,bumper);
	
	//rotates robot into position for point five
	actual_result_angle = Turn(client,position2d,bumper,-1.18662);
	printf("Results Returned from TurnL %f\n",actual_result_angle);
	printPos(client,position2d,bumper);
	
	//moves robot from position four to position five
	actual_result_trans = Move(client,position2d,bumper,6.83,0.0);
	printf("Results Returned from Move: %f\n",actual_result_trans);
	printPos(client,position2d,bumper);
#endif
	
	// Shutdown and Unsubscribe Devices
	playerc_position2d_unsubscribe(position2d);
	playerc_position2d_destroy(position2d);
	playerc_bumper_unsubscribe(bumper);
	playerc_bumper_destroy(bumper);
	playerc_client_disconnect(client);
	playerc_client_destroy(client);
	
	return 0;
}