Exemplo n.º 1
0
int main()
{	
  printf("Line Follow."); // announce the program	
  sleep(1.0); // wait 1 second

  create_connect(); // Open the connection between CBC and Create	
  int ana0 = 0, ana1 = 0; // variables to store the results of the analog sensors
	create_full(); // We don't care about safety
	while(get_create_lbump(0) == 0 && get_create_rbump(0) == 0){ //while the bumper is not pressed
		ana0 = analog10(0); // left sensor
		ana1 = analog10(1); // right sensor
		
		printf("analog 0: %d\n", ana0);// print results
		printf("analog 1: %d\n", ana1);
		if((ana0 < 200) && (ana1 > 200)) // if the left sensor is off and right is on black line
		{
			create_spin_CW(128); // spin the create Clock Wise
		}else if((ana1 < 200) && (ana0 > 200)) // else if reversed
		{
			create_spin_CCW(128); // spin Counter Clock Wise
		}else if((ana0 < 200) && (ana1 < 200)) // else neither is on the line
		{
			create_drive_straight(180); // drive straight
		}
		
	}
  create_stop(); // Stop the Create
  create_disconnect(); // Disconnect the Create
}
Exemplo n.º 2
0
/*
 * Class:     cbccore_low_Create
 * Method:    create_full
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_cbccore_low_Create_create_1full(JNIEnv *env, jobject obj)
{
#ifdef CBC
    create_full();
#else
    printf("Java_cbccore_low_Create_create_1full stub\n");
#endif
}
Exemplo n.º 3
0
int main()
{
	create_connect();
	init_servo();


	//light_it_up(LIGHT_PORT);
	lightstart(LIGHT_PORT,120.0);

	create_full();
	create_drive_segment(HIGH_SPEED, -150);
	start_process(set_top);
	create_drive_arc(HIGH_SPEED, -200, 155);
	create_drive_segment(HIGH_SPEED, -365);
	create_drive_arc(HIGH_SPEED, 90, -64);
	create_drive_segment(HIGH_SPEED, -85);
	create_cease();
	set_top();
	align_twall();
	grab_top_de();
	create_spin_angle(400,-165);
	create_drive_segment(HIGH_SPEED, -320);
	//align_wall();
	create_stop();
	create_sync();
	dump_kelp_de();
	create_drive_segment(HIGH_SPEED,30);//go away from starting box
	create_spin_angle(HIGH_SPEED, -78);//turn to gate part 1
	create_drive_segment(HIGH_SPEED, 938);//go to gate
	create_drive_arc(HIGH_SPEED,185,84);//arc to gate
	//create_drive_time(HIGH_SPEED,1800);//go through the gate
	/*
	create_drive_segment(HIGH_SPEED,1470);
	create_drive_segment(HIGH_SPEED,-100);
	create_spin_angle(HIGH_SPEED,78);
	*/
	create_cease();
	create_drive_straight(HIGH_SPEED);//go onto oppponent's side of board
	msleep(1400);
	create_stop();
	create_arc(350,550);//arc to the opponent's mpa
	msleep(2500L);
	create_stop();//pause to keep the creat
	create_drive_straight(HIGH_SPEED);//go onto oppponent's side of board
	msleep(750);
	create_stop();
	create_drive_straight(-HIGH_SPEED);//go onto oppponent's side of board
	msleep(5000);
	create_stop();
	/*
	create_drive_segment(500,-500);//go past the IC
	create_drive_arc(320,-250,25);//arc to
	create_drive_arc(320,250,-8);
	*/
	//create_drive_segment(HIGH_SPEED,-750);
	//create_drive_arc(HIGH_SPEED,100,84);
	//create_drive_segment(HIGH_SPEED,1300);
}
Exemplo n.º 4
0
int main()
{
	create_connect();
	create_full();
	while(digital(15) == 0);
	create_drive_direct(-1500, -1500);
	while(!(a_button_clicked()));
	return 0;
}
Exemplo n.º 5
0
int main()
{
	create_connect();
	create_full();
	while(!(a_button_clicked())){
		display_clear();
		printf("cw:%d\nlw:%d\nrw:%d\n", get_create_cwdrop(), get_create_lwdrop(), get_create_rwdrop());
		msleep(20);
	}
	return 0;
}
int main() 
{
	ROBOT = CREATE_ROBOT;
	create_connect();
	set_speeds();
	create_full();
	
	// test_modest_forward_backward();
	test_modest_left_right();
	
	return SUCCESS;
}
Exemplo n.º 7
0
int main()
{
	create_connect();
	create_full();
	float sec = seconds();
	set_create_distance(0);
	create_drive_distance(50, get_pot_reading(1, 1, 50), FORWARDS);
	printf("distance traveled = %i, time = %f\n", get_create_distance(), seconds() - sec);
	//sleep(2);
	//create_spin_degrees(90, 300, LEFT);
	//printf("%d\n", i);
	create_disconnect();
	return 0;
}
Exemplo n.º 8
0
int main()
{
	create_connect();
	enable_servo(ccport);
	
	create_full();	
	start_morse();
	morse("Botball", 1);
	/*	motor(1,100);
	motor(0,-100);
	motor(1,0);
	msleep(5000);
	motor(3,100);
	wait_for_morse();
	motor(0,0);
	motor(3,0);
	*/
	
	create_disconnect();
}
Exemplo n.º 9
0
void main()
{
    networkSetup();
    if (create_connect())exit(0);
    sleep(1);
    create_full();
    connectToServer();

    //control() in new thread
    int unused = 0;
    pthread_t controlThread;
    int threadError = pthread_create (&controlThread,NULL,control, &unused);
    if(threadError)
    {
        printf("thread could not be started! \nerror: %d \nexiting program!\n",threadError);
        exit(0);
    }

    serverCommunication();
}
Exemplo n.º 10
0
int main()
{
	printf("initializing. please wait.\n");
	enable_servos();
	sleep(.25);
	mav(3,100);
	sleep(.8);
	off(3);
	enableServoDown();
	sleep(.5);
	release();
	set_servo_position(1,120); // mini servo down
	mav(3, 400); // move arm to open position -- test values -- should be slightly angeled forwards
	sleep(1);
	off(3);
	printf("servos initalized.\n");
	
	create_connect();
	create_full();
	set_create_total_angle(0);
	printf("create initialized.\n");
	
	benDance();
}
Exemplo n.º 11
0
int main()
{
	get_mode();
	create_connect();
	create_full();
	set_servo_position(BAR_SERVO, BAR_CLOSED_POSITION);
	set_servo_position(CLAW_SERVO, CLAW_OPEN_POSITION);
	set_servo_position(GYRO_SERVO, GYRO_SETTING_POSITION);
	enable_servos();
	msleep(3000);
	// operate_winch(WINCH_START_POSITION);
	// set_servo_position(GYRO_SERVO, GYRO_START_POSITION);
	// press_a_to_continue();
	
	// set_servo_position(GYRO_SERVO, GYRO_SETTING_POSITION);
	// msleep(2000);
	drop_three_hangers();
	//pick_up_first_doubler();
	pick_up_cube();
	
	
	create_disconnect();
	return 0;
}
int main() 
{
	printf("checklist");
	printf("hit black button when ready");
	while(black_button());
	printf("MAKE SURE CREATE IS ON!!!!!!!!");
	while(!black_button());
	printf("MAKE SURE ARM IS IN DOWN POSITION!!!!!!!!");
	while(!black_button());
	printf("MAKE SURE ARM AND CLAW WORK");
	while(!black_button());
	printf("CHECK POSITION OF CLAW AND ARM");
	while(!black_button());
	printf("MAKE SURE LIGHT SENSORT IS CALIBRATED");
	while(!black_button());
	// this starts the robot    SECTion 1
	wait_for_light(0);
	shut_down_in(120.0);
	//this shuts the robot down after 120.0 seconds
	while(create_connect());
	
		//connects create to cbc
	set_servo_position(3, 0);
	set_servo_position(0, 1800);
	enable_servos();
	msleep(500);
	create_full();
	//section 2
	create_drive_direct(SUPER_FAST, SUPER_FAST);
	msleep(1646);
	//leave beach
	create_stop();
	msleep(300);
	create_drive_direct(SUPER_FAST, -SUPER_FAST);
	msleep(435);
	//turn towards center
	create_stop();
	msleep(300);
	create_drive_direct(SUPER_FAST, SUPER_FAST);
	msleep(1600);
	//move towards botguy
	create_stop();
	msleep(500);
	//section 3
	set_servo_position(0, 1424);
	msleep(1800);
	set_servo_position(0, 1100);
	msleep(1800);
	set_servo_position(0, 924);
	msleep(1800);
	set_servo_position(0, 724);
	msleep(1800);
	set_servo_position(3, 1024);
	msleep(1800);
	set_servo_position(0, 924);
	msleep(1800);
	set_servo_position(0, 1100);
	msleep(1800);
	set_servo_position(0, 1200);
	msleep(2000);
	
	
	
	//retrieve botguy
	//section 4
	create_drive_direct(-FAST, FAST);
	msleep(445);
	create_stop();
	create_drive_direct(-FAST, -FAST);
	msleep(2000);
	create_stop();
	create_drive_direct(FAST, -FAST);
	msleep(445);
	create_stop();	
	create_drive_direct(-FAST, -FAST);
	msleep(900);
	create_stop();
	msleep(1600);
	create_stop();
	set_servo_position(3, 0);
	set_servo_position(0, 1800);
	msleep(1200);
	set_servo_position(0, 1200);
	msleep(1000);
	set_servo_position(0, 1800);
	msleep(1000);
	create_drive_direct(1000, 1000);
	msleep(800);
	create_drive_direct(-1000, -1000);
	msleep(800);
	DRIVE(SUPER_FAST);
	MSLEEP(800);
	TURN(-SUPER_FAST, SUPER_FAST);
	MSLEEP(460);
	DRIVE(SUPER_FAST);
	MSLEEP(1380);
	TURN(SUPER_FAST, -SUPER_FAST);
	MSLEEP(425);
	DRIVE(SUPER_FAST);
	SLEEP(1.5);
	while(get_create_lbump(0.01) == 0)
	{
		DRIVE(SUPER_FAST);
	}
	TURN(-SUPER_FAST, SUPER_FAST);
	MSLEEP(435);
	TURN(SUPER_FAST, 975);
	MSLEEP(500);
	while(get_create_rbump(0.01) == 0)
	{
		TURN(SUPER_FAST, 990);
	}
	
	
	
	create_stop();
	create_disconnect();
	
	
	
	
}