Exemple #1
0
int main (void)
{
  draw_lcd_t lcd;

  // outputs
  GPIOSetDir(OLED_SSEL_PORT, OLED_SSEL_PIN, GPIO_OUTPUT);
  GPIOSetDir(OLED_DC_PORT, OLED_DC_PIN, GPIO_OUTPUT);
  GPIOSetDir(OLED_RESET_PORT, OLED_RESET_PIN, GPIO_OUTPUT);

  GPIOSetValue(OLED_SSEL_PORT, OLED_SSEL_PIN, 1);
  GPIOSetValue(OLED_DC_PORT, OLED_DC_PIN, 1);
  GPIOSetValue(OLED_RESET_PORT, OLED_RESET_PIN, 1);

  SSP0Init(6000000);

  printf("\nInitializing oled driver...");
  oled_init(&lcd);

  rainbow(&lcd);

  //enter forever loop -
  while (1) {
  }

  return 0;
}
Exemple #2
0
//executes 1 command line
void execute_command(char * command_line){
    
    if (command_line[0]=='#') return; //=comments
    
    if (write_to_thread_buffer){
        if (strncmp(command_line, "thread_stop", 11)==0){
            if (mode==MODE_TCP){
                write_to_thread_buffer=0;
                if (debug) printf("Thread stop.\n");
                if (thread_write_index>0) start_thread=1; //remember to start the thread when client closes the TCP/IP connection
            }        
        }else{
            if (debug) printf("Write to thread buffer: %s\n", command_line);
            while (*command_line!=0){
                write_thread_buffer(*command_line); //for TCP/IP we write to the thread buffer
                command_line++;
            }
            write_thread_buffer(';');
        }
    }else{
 
        char * arg = strchr(command_line, ' ');
        char * command =  strtok(command_line, " \r\n");    
        
        if (arg!=NULL) arg++;
        
        if (strcmp(command, "render")==0){
            render(arg);
        }else if (strcmp(command, "rotate")==0){
            rotate(arg);
        }else if (strcmp(command, "delay")==0){
            if (arg!=NULL)	usleep((atoi(arg)+1)*1000);
        }else if (strcmp(command, "brightness")==0){
            brightness(arg);
        }else if (strcmp(command, "rainbow")==0){
            rainbow(arg);
        }else if (strcmp(command, "fill")==0){	
            fill(arg);
        }else if (strcmp(command, "do")==0){
            start_loop(arg);
        }else if (strcmp(command, "loop")==0){
            end_loop(arg);
        }else if (strcmp(command, "thread_start")==0){ //start a new thread that processes code
            if (thread_running==0 && mode==MODE_TCP) init_thread(arg);
        }else if (strcmp(command, "setup")==0){
            setup_ledstring(arg);
        }else if (strcmp(command, "settings")==0){
            print_settings();
        }else if (strcmp(command, "debug")==0){
            if (debug) debug=0;
            else debug=1;
        }else if (strcmp(command, "exit")==0){
            printf("Exiting.\n");
            exit_program=1;
        }else{
            printf("Unknown cmd: %s\n", command_line);
        }
    }
}
Exemple #3
0
void RainbowScreen::animate() {
	khroma.leds.clear();
	anim.animate();

	for (int i = -khroma.get_halfsize(); i < khroma.get_halfsize(); ++i) {
		khroma.leds.set_rgb(
			i,
			rainbow(i + anim*1536),
			rainbow(i + 512 + anim*1536),
			rainbow(i + 1024 + anim*1536)
		);
	}

	if (khroma.btn1.touched(true) && khroma.btn2.touched(true)) {
		game.initscreen();
	}
}
void loop() {
  // Some example procedures showing how to display to the pixels
  
  colorWipe(Color(255, 0, 0), 50);
  colorWipe(Color(0, 255, 0), 50);
  colorWipe(Color(0, 0, 255), 50);
  rainbow(20);
  rainbowCycle(20);
}
Exemple #5
0
int main(void)
{
	while(1){
        rainbow(3, 500000);

        flash(RED, 3, 500000);
        flash(GREEN, 3, 500000);
        flash(BLUE, 3, 500000);
        flash(CYAN, 3, 500000);
        flash(PURPLE, 3, 500000);
        flash(YELLOW, 3, 500000);
        flash(WHITE, 3, 500000);
    }
}
Exemple #6
0
Fichier : 3d.c Projet : hrldcpr/iso
void staircase() {
  int x, y, i;
  // make a grid
  for (y = -HEIGHT/2; y < HEIGHT/2; y++) {
    for (x = -WIDTH/2; x < WIDTH/2; x++)
      add_cube(x, y, 0);
  }

  // make an ambiguous staircase
  unsigned char r, g, b;
  for (i = 6; i >= 1; i--) {
    add_cube(i - WIDTH/2, i - HEIGHT/2, i + 1);
    rainbow(i / 6.0, &r, &g, &b);
    add_ball_on(r, g, b, cubes);
  }
}
void loop() 
{
	if (patternIndex == 0) {
		strobe(c1, 200);
	}
	if (patternIndex == 1) {
		sprite(PIXEL_COUNT, c1, c2, c3, 90);
	}
	if (patternIndex == 2) {
		snake(c1, c2, 10);
	}
	if (patternIndex == 3) {
		rainbow(20);
	}
	if (patternIndex == -1) {
		stripSet(OFF, 0);
	}
}
Exemple #8
0
void Mandelbrot::generate()
{
    std::complex<double> t1, t2, c;

    timer.start();

    for(unsigned int y = 0; y < m_height; ++y)
    {
        for(unsigned int x = 0; x < m_width; ++x)
        {
            //t1 = std::complex<double>(0.0,0.0);
            t1 = std::complex<double>(-0.835,-0.2321);
            c = plane[y][x];

            for(unsigned int i = 0; i < 1024; ++i)
            {
                t1 = t1 * t1 - c;  //Julia
                //t1 = t1 * t1 + c;  //Mandel

                //ship

                //t2 = std::complex<double>(fabs(t1.real()),fabs(t1.imag()));
                //t1 = t2*t2 - c;
                if(abs(t1) > 2.0)
                {
                    double scale = (i +1-log(log(abs(t1)))/log(2))/36;
                    image[y][x] = rainbow(scale);
                    break;
                }
            }

            if(abs(t1) <= 2.0)
            {
                image[y][x] = png::rgb_pixel(0.0,0.0,0.0);
            }
        }
    }

    timer.stop();

    std::cout << timer.elapsed << std::endl;
}
void SuccessManager::sRainbow(int type) {
    if (hardMode && (!bRainbow || !bDoubleRainbow)) {
        if (succEveryTypeInARow[type]) {
            for (int i=0; i<8; i++) succEveryTypeInARow[i] = 0;
            bRainbow = false;
        } else {
            succEveryTypeInARow[type] = 1;
        }
        if (rainbow(succEveryTypeInARow)) {
            if (!bRainbow) {
                if (gameCenterAPI)
                    gameCenterAPI->unlockAchievement(ERainbow);
                bRainbow = true;
            } else {
                if (gameCenterAPI)
                    gameCenterAPI->unlockAchievement(EDoubleRainbow);
                bDoubleRainbow = true;
            }
        }
    }
}
void loop() {
  // Some example procedures showing how to display to the pixels:
  // Do not run more than one of these at a time, or the b/g tasks 
  // will be blocked.
  //--------------------------------------------------------------
  
  //strip.setPixelColor(0, strip.Color(255, 0, 255));
  //strip.show();
  
  //colorWipe(strip.Color(255, 0, 0), 50); // Red
  
  //colorWipe(strip.Color(0, 255, 0), 50); // Green
  
  //colorWipe(strip.Color(0, 0, 255), 50); // Blue
  
  rainbow(20);
  
  //rainbowCycle(20);
  
  //colorAll(strip.Color(0, 255, 255), 50); // Magenta
}
Exemple #11
0
 void resizeEvent(QResizeEvent *) {
     setPixmap(rainbow(width(), height()));
 }
Exemple #12
0
void showLed3AndHelloServo(int val){

      Serial.println("led array was....");
      Serial.println(val);
      Serial.println("ooooooooooooooooooo");

      //strip.clear();
      switch(val){
        case 123://how
          colorWipe(strip.Color(255, 255, 255), 100); // white
          colorWipe(strip.Color(0, 0, 0), 100); // black
                    colorWipe(strip.Color(255, 255, 255), 100); // white
                    colorWipe(strip.Color(0, 0, 0), 100); // black
                              colorWipe(strip.Color(255, 255, 255), 100); // white
                              colorWipe(strip.Color(0, 0, 0), 100); // black

          //TODO Arduinoをリセット
          wdt_enable(WDTO_15MS); // turn on the WatchDog and don't stroke it.
          for(;;) {
            // do nothing and wait for the eventual...
          }

          break;
        case 1://サーボ準備
          sv.attach(SERVO_PIN);
          Serial.println("servo attached...");//サーボの位置確認
          break;
        case 2://サーボ回転
          Serial.println(sv.read());//サーボの位置確認
          moveServoShaft(0, 10);
          //delay(100);//TODO 不要
          delay(1000);
          break;
        case 3://サーボ戻す
          Serial.println(sv.read());//サーボの位置確認
          moveServoShaft(90, 10);
          //delay(100);//TODO 不要
          delay(1000);
          break;
        case 4://サーボ終了
          sv.detach();
          break;
        case 0://クリア
          strip.clear();
          break;
        case 555://白
        case 5://白
          colorWipe(strip.Color(255, 255, 255), 80); // white
          delay(3000);
          colorWipe(strip.Color(0, 0, 0), 100); // black

          break;
        case 666://紫
        case 6://紫
            colorWipe(strip.Color(105, 14, 102), 80); // purple
            delay(3000);
            colorWipe(strip.Color(0, 0, 0), 100); // black
          break;
        case 777://ピンク
        case 7://ピンク
          colorWipe(strip.Color(252, 18, 245), 80); // pink
          delay(3000);
          colorWipe(strip.Color(0, 0, 0), 100); // black
          break;
        case 888://レインボー?
        case 8://レインボー?
          rainbow(20);
          //rainbowCycle(80);
          break;
        case 999://黒 = 消す
        case 9://黒 = 消す
          colorWipe(strip.Color(0, 0, 0), 10); // black
          strip.clear();
          break;
        case 100://予備
          break;
        default:
          Serial.println("this is for servo");
          colorWipe(strip.Color(0, 0, 0), 10); // black
          strip.clear();
          break;
      }
}
void loop()
{
  rainbow(20);
}
Exemple #14
0
// #########################################################################
//  Draw the meter on the screen, returns x coord of righthand side
// #########################################################################
int ringMeter(int value, int vmin, int vmax, int x, int y, int r, char *units, byte scheme)
{
  // Minimum value of r is about 52 before value text intrudes on ring
  // drawing the text first is an option
  
  x += r; y += r;   // Calculate coords of centre of ring
  int  w = r / 4;    // Width of outer ring is 1/4 of radius  
  int  angle = 150;  // Half the sweep angle of meter (300 degrees)
  int  text_colour = 0; // To hold the text colour
  int  v = map(value, vmin, vmax, -angle, angle); // Map the value to an angle v
  byte seg = 5; // Segments are 5 degrees wide = 60 segments for 300 degrees
  byte inc = 5; // Draw segments every 5 degrees, increase to 10 for segmented ring

  // Draw colour blocks every inc degrees
  for (int i = -angle; i < angle; i += inc) {

    // Choose colour from scheme
    int colour = 0;
    switch (scheme) {
      case 0: colour = ILI9341_RED; break; // Fixed colour
      case 1: colour = ILI9341_GREEN; break; // Fixed colour
      case 2: colour = ILI9341_BLUE; break; // Fixed colour
      case 3: colour = rainbow(map(i, -angle, angle, 0, 127)); break; // Full spectrum blue to red
      case 4: colour = rainbow(map(i, -angle, angle, 63, 127)); break; // Green to red (high temperature etc)
      case 5: colour = rainbow(map(i, -angle, angle, 127, 63)); break; // Red to green (low battery etc)
      default: colour = ILI9341_BLUE; break; // Fixed colour
    }

    // Calculate pair of coordinates for segment start
    float sx = cos((i - 90) * 0.0174532925);
    float sy = sin((i - 90) * 0.0174532925);
    uint16_t x0 = sx * (r - w) + x;
    uint16_t y0 = sy * (r - w) + y;
    uint16_t x1 = sx * r + x;
    uint16_t y1 = sy * r + y;

    // Calculate pair of coordinates for segment end
    float sx2 = cos((i + seg - 90) * 0.0174532925);
    float sy2 = sin((i + seg - 90) * 0.0174532925);
    int x2 = sx2 * (r - w) + x;
    int y2 = sy2 * (r - w) + y;
    int x3 = sx2 * r + x;
    int y3 = sy2 * r + y;

    if (i < v) { // Fill in coloured segments with 2 triangles
      tft.fillTriangle(x0, y0, x1, y1, x2, y2, colour);
      tft.fillTriangle(x1, y1, x2, y2, x3, y3, colour);
      text_colour = colour; // Save the last colour drawn
    }
    else // Fill in blank segments
    {
      tft.fillTriangle(x0, y0, x1, y1, x2, y2, 0x0005);
      tft.fillTriangle(x1, y1, x2, y2, x3, y3, 0x0005);
    }
  }

  // Convert value to a string
  char buf[10];
  byte len = 4; if (value > 999) len = 5;
  dtostrf(value, len, 0, buf);

  // Set the text colour to default
  tft.setTextColor(ILI9341_WHITE, ILI9341_BLACK);
  // Uncomment next line to set the text colour to the last segment value!
  // tft.setTextColor(text_colour, ILI9341_BLACK);
  
  // Print value, if the meter is large then use big font 6, othewise use 4
  //if (r > 84) tft.drawCentreString(buf, x - 5, y - 20, 6); // Value in middle
 // else tft.drawCentreString(buf, x - 5, y - 20, 4); // Value in middle

  // Print units, if the meter is large then use big font 4, othewise use 2
  tft.setTextColor(ILI9341_WHITE, ILI9341_BLACK);
  //if (r > 84) tft.drawCentreString(units, x, y + 30, 4); // Units display
 // else tft.drawCentreString(units, x, y + 5, 2); // Units display

  // Calculate and return right hand side x coordinate
  return x + r;
}
Exemple #15
0
void set_volume() {
    if (power==1) {
        rainbow(volume);
        send_pot_value(volume);
    }
}
Exemple #16
0
void GameScreen::paintEvent(QPaintEvent * event) {


	if (r >= 255) {
		r_dir = RANGE_DOWN;
		g_dir = RANGE_UP;
		b_dir = RANGE_IDLE;
	}

	if (g >= 255) {
		r_dir = RANGE_IDLE;
		g_dir = RANGE_DOWN;
		b_dir = RANGE_UP;
	}

	if (b >= 255) {
		r_dir = RANGE_UP;
		g_dir = RANGE_IDLE;
		b_dir = RANGE_DOWN;
	}

	if (r_dir == RANGE_UP) {
		r += 5;
	}
	else if (r_dir == RANGE_DOWN){
		r -= 5;
	}
	if (g_dir == RANGE_UP) {
		g += 5;
	}
	else if (g_dir == RANGE_DOWN){
		g -= 5;
	}
	if (b_dir == RANGE_UP) {
		b += 5;
	}
	else if (b_dir == RANGE_DOWN) {
		b -= 5;
	}

	QColor white(255, 255, 255);
	QColor darkWhite(250, 250, 250);
	QColor pink(255, 192, 203);
	QColor brown(97, 25, 11);
	QColor rainbow(r, g, b);
	QColor neg_rainbow(255 - r, 255 - g, 255 - b);
	
	QPainter painter(this);
	painter.fillRect(0, 0, width(), height(), darkWhite);
	painter.setPen(QPen(Qt::black, 1));

	if (mode == MODE_MENU) {
		painter.drawText(400, 300, "Press the Space Key to Start");
	}
	else if (mode == MODE_RUNNING) {

		//draw coffee
		painter.setPen(QPen(darkWhite, 1));
		for (int i = 0; i < coffee_loc.size(); i++) {
			painter.drawRect(coffee_loc[i].first * sq_s, coffee_loc[i].second * sq_s, sq_s, sq_s);
			painter.fillRect(coffee_loc[i].first * sq_s + 1, coffee_loc[i].second * sq_s + 1, sq_s - 1, sq_s - 1, rainbow);
		}

		//draw fruit
		painter.setPen(QPen(pink, 1));
		painter.setBrush(pink);
		for (int i = 0; i < fruit_loc.size(); i++) {
			painter.drawEllipse((fruit_loc[i].first * sq_s), (fruit_loc[i].second * sq_s), sq_s, sq_s);
		}

		//draw snake
		painter.setPen(QPen(darkWhite, 1));
		for (int i = 0; i < body.size(); i++) {
			painter.drawRect(body[i].first * sq_s, body[i].second * sq_s, sq_s, sq_s);
			painter.fillRect(body[i].first * sq_s + 1, body[i].second * sq_s + 1, sq_s - 1, sq_s - 1,neg_rainbow);
		}

	}
	else if (mode == MODE_GAMEOVER) {
		painter.setPen(QPen(Qt::lightGray, 1));
		for (int i = 0; i < body.size(); i++) {
			painter.drawRect(body[i].first * sq_s, body[i].second * sq_s, sq_s, sq_s);
			painter.fillRect(body[i].first * sq_s + 1, body[i].second * sq_s + 1, sq_s - 1, sq_s - 1, Qt::gray);
		}
		painter.setPen(QPen(Qt::red, 1));
		painter.drawText(400, 300, "GAMEOVER");
	}




	


}
Exemple #17
0
int main(int argc, char **argv) {

	int spi_fd;
	int effect=EFFECT_RANDOM;

	if (argc>1) {
		if ((!strncmp(argv[1],"-h",2)) || (!strncmp(argv[1],"help",4))) {
			help(argv[0]);
			return 0;
		}

		if (!strncmp(argv[1],"bargraph_mannual",15)) {
			effect=EFFECT_BARGRAPH_MANUAL;
		}

		if (!strncmp(argv[1],"bargraph",8)) {
			effect=EFFECT_BARGRAPH;
		}

		if (!strncmp(argv[1],"disable",7)) {
			effect=EFFECT_DISABLE;
		}

		if (!strncmp(argv[1],"falling",7)) {
			effect=EFFECT_FALLING;
		}


		if (!strncmp(argv[1],"fish",4)) {
			effect=EFFECT_FISH;
		}

		if (!strncmp(argv[1],"gradient",8)) {
			effect=EFFECT_GRADIENT;
		}

		if (!strncmp(argv[1],"noise",5)) {
			effect=EFFECT_NOISE;
		}

		if (!strncmp(argv[1],"pulsar",6)) {
			effect=EFFECT_PULSAR;
		}

		if (!strncmp(argv[1],"rainbow",7)) {
			effect=EFFECT_RAINBOW;
		}

		if (!strncmp(argv[1],"stars",5)) {
			effect=EFFECT_STARS;
		}

		if (!strncmp(argv[1],"red_green",9)) {
			effect=EFFECT_RED_GREEN;
		}

		if (!strncmp(argv[1],"blue_yellow",11)) {
			effect=EFFECT_BLUE_YELLOW;
		}

		if (!strncmp(argv[1],"two_color_scroll",15)) {
			effect=EFFECT_TWO_COLOR_SCROLL;
		}

		if (!strncmp(argv[1],"scanner_blinky",14)) {
			effect=EFFECT_SCANNER_BLINKY;
		} else

		if (!strncmp(argv[1],"scanner_dual",12)) {
			effect=EFFECT_SCANNER_DUAL;
		} else

		if (!strncmp(argv[1],"scanner_random",14)) {
			effect=EFFECT_SCANNER_RANDOM;
		} else

		if (!strncmp(argv[1],"scanner",7)) {
			effect=EFFECT_SCANNER;
		}


	}

	spi_fd=lpd8806_init();
	if (spi_fd<0) {
		exit(-1);
	}

	switch(effect) {
		case EFFECT_BARGRAPH:
			bargraph(spi_fd,argc>2?argv[2]:NULL,
					argc>3?argv[3]:NULL);
			break;

		case EFFECT_BARGRAPH_MANUAL:
			bargraph_manual(spi_fd,argc>2?argv[2]:NULL,
					argc>3?argv[3]:NULL);
			break;

		case EFFECT_DISABLE:
			disable(spi_fd);
			break;

		case EFFECT_FALLING:
			falling(spi_fd,
				argc>2?argv[2]:NULL,
				argc>2?argv[3]:NULL);
			break;

		case EFFECT_FISH:
			fish(spi_fd,argc>2?argv[2]:NULL);
			break;

		case EFFECT_GRADIENT:
			gradient(spi_fd,argc>2?argv[2]:NULL);
			break;

		case EFFECT_NOISE:
			noise(spi_fd);
			break;

		case EFFECT_PULSAR:
			pulsar(spi_fd,argc>2?argv[2]:NULL);
			break;

		case EFFECT_RAINBOW:
			rainbow(spi_fd);
			break;

		case EFFECT_STARS:
			stars(spi_fd,argc>2?argv[2]:NULL,
					argc>3?argv[3]:NULL);
			break;
		case EFFECT_TWO_COLOR_SCROLL:
			two_color_scroll(spi_fd,
					argc>2?argv[2]:NULL,
					argc>3?argv[3]:NULL,
					argc>4?argv[4]:NULL);
			break;

		case EFFECT_RED_GREEN:
			two_color_scroll(spi_fd,
					"red",
					"green",
					"1");
			break;
		case EFFECT_BLUE_YELLOW:
			two_color_scroll(spi_fd,
					"blue",
					"yellow",
					"0");
			break;

		case EFFECT_SCANNER:
			scanner(spi_fd,argc>2?argv[2]:NULL);
			break;

		case EFFECT_SCANNER_BLINKY:
			scanner_blinky(spi_fd);
			break;

		case EFFECT_SCANNER_DUAL:
			scanner_dual(spi_fd,
				argc>2?argv[2]:NULL,
				argc>3?argv[3]:NULL);
			break;

		case EFFECT_SCANNER_RANDOM:
			scanner_random(spi_fd);
			break;


	}

	lpd8806_close(spi_fd);

	return 0;
}
  void onGMM(const gaussian_mixture_model::GaussianMixture & mix)
  {
    visualization_msgs::MarkerArray msg;
    ROS_INFO("gmm_rviz_converter: Received message.");

    uint i;

    for (i = 0; i < mix.gaussians.size(); i++)
    {
      visualization_msgs::Marker marker;

      marker.header.frame_id = m_frame_id;
      marker.header.stamp = ros::Time::now();
      marker.ns = m_rviz_namespace;
      marker.id = i;
      marker.type = visualization_msgs::Marker::SPHERE;
      marker.action = visualization_msgs::Marker::ADD;
      marker.lifetime = ros::Duration();

      Eigen::Vector3f coords;
      for (uint ir = 0; ir < NUM_OUTPUT_COORDINATES; ir++)
        coords[ir] = m_conversion_mask[ir]->GetMean(m_conversion_mask,mix.gaussians[i]);
      marker.pose.position.x = coords.x();
      marker.pose.position.y = coords.y();
      marker.pose.position.z = coords.z();

      Eigen::Matrix3f covmat;
      for (uint ir = 0; ir < NUM_OUTPUT_COORDINATES; ir++)
        for (uint ic = 0; ic < NUM_OUTPUT_COORDINATES; ic++)
          covmat(ir,ic) = m_conversion_mask[ir]->GetCov(m_conversion_mask,mix.gaussians[i],ic);

      Eigen::EigenSolver<Eigen::Matrix3f> evsolver(covmat);

      Eigen::Matrix3f eigenvectors = evsolver.eigenvectors().real();
      if (eigenvectors.determinant() < 0.0)
        eigenvectors.col(0) = - eigenvectors.col(0);
      Eigen::Matrix3f rotation = eigenvectors;
      Eigen::Quaternionf quat = Eigen::Quaternionf(Eigen::AngleAxisf(rotation));

      marker.pose.orientation.x = quat.x();
      marker.pose.orientation.y = quat.y();
      marker.pose.orientation.z = quat.z();
      marker.pose.orientation.w = quat.w();

      Eigen::Vector3f eigenvalues = evsolver.eigenvalues().real();
      Eigen::Vector3f scale = Eigen::Vector3f(eigenvalues.array().abs().sqrt());
      if (m_normalize)
        scale.normalize();
      marker.scale.x = mix.weights[i] * scale.x() * m_scale;
      marker.scale.y = mix.weights[i] * scale.y() * m_scale;
      marker.scale.z = mix.weights[i] * scale.z() * m_scale;

      marker.color.a = 1.0;
      rainbow(float(i) / float(mix.gaussians.size()),marker.color.r,marker.color.g,marker.color.b);

      msg.markers.push_back(marker);
    }

    // this a waste of resources, but we need to delete old markers in some way
    // someone should add a "clear all" command to rviz
    // (using expiration time is not an option, here)
    for ( ; i < m_max_markers; i++)
    {
      visualization_msgs::Marker marker;
      marker.id = i;
      marker.action = visualization_msgs::Marker::DELETE;
      marker.lifetime = ros::Duration();
      marker.header.frame_id = m_frame_id;
      marker.header.stamp = ros::Time::now();
      marker.ns = m_rviz_namespace;
      msg.markers.push_back(marker);
    }

    m_pub.publish(msg);
    ROS_INFO("gmm_rviz_converter: Sent message.");
  }
Exemple #19
0
int main(int argc, char **argv) {

	int spi_fd;
	int effect=EFFECT_RANDOM;

	if (argc>1) {
		if (!strncmp(argv[1],"-h",2)) {
			help(argv[0]);
			return 0;
		}

		if (!strncmp(argv[1],"bargraph",8)) {
			effect=EFFECT_BARGRAPH;
		}

		if (!strncmp(argv[1],"rainbow",7)) {
			effect=EFFECT_RAINBOW;
		}

		if (!strncmp(argv[1],"stars",5)) {
			effect=EFFECT_STARS;
		}

		if (!strncmp(argv[1],"red_green",9)) {
			effect=EFFECT_RED_GREEN;
		}

		if (!strncmp(argv[1],"blue_yellow",11)) {
			effect=EFFECT_BLUE_YELLOW;
		}

		if (!strncmp(argv[1],"two_color_scroll",15)) {
			effect=EFFECT_TWO_COLOR_SCROLL;
		}

	}

	spi_fd=lpd8806_init();
	if (spi_fd<0) {
		exit(-1);
	}

	switch(effect) {
		case EFFECT_BARGRAPH:
			bargraph(spi_fd,argc>2?argv[2]:NULL,
					argc>3?argv[3]:NULL);
			break;
		case EFFECT_RAINBOW:
			rainbow(spi_fd);
			break;
		case EFFECT_STARS:
			stars(spi_fd,argc>2?argv[2]:NULL,
					argc>3?argv[3]:NULL);
			break;
		case EFFECT_TWO_COLOR_SCROLL:
			two_color_scroll(spi_fd,
					argc>2?argv[2]:NULL,
					argc>3?argv[3]:NULL,
					argc>4?argv[4]:NULL);
			break;

		case EFFECT_RED_GREEN:
			two_color_scroll(spi_fd,
					"red",
					"green",
					"1");
			break;
		case EFFECT_BLUE_YELLOW:
			two_color_scroll(spi_fd,
					"blue",
					"yellow",
					"0");
			break;



	}

	lpd8806_close(spi_fd);

	return 0;
}