<commit_before>/* 
 * rosserial Ultrasound Example
 * 
 * This example is for the Maxbotix Ultrasound rangers.
 */

#include <ros.h>
#include <ros/time.h>
#include <sensor_msgs/Range.h>

#define sensNumber 3
#define firstTrigPin 3
#define firstEchoPin 9


ros::NodeHandle  nh;
sensor_msgs::Range range_msg;
ros::Publisher pub_range( "/ultrasound", &range_msg);
char frameid[] = "/ultrasound";

int trigPin=firstTrigPin;
int echoPin=firstEchoPin;

void increasepins(){
  trigPin++;
  echoPin++;
  if(trigPin>firstTrigPin+sensNumber){
    trigPin=firstTrigPin;}
  if(echoPin>firstEchoPin+sensNumber){
    echoPin=firstEchoPin;}
}

void setup(){
  nh.initNode();
  nh.advertise(pub_range);
  for(int i=0;i<sensNumber;i++){
   pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  increasepins();  
}
  range_msg.radiation_type = sensor_msgs::Range::ULTRASOUND;
  range_msg.header.frame_id =  frameid;
  range_msg.field_of_view = 0.1;  
  range_msg.min_range = 0.0;
  range_msg.max_range = 6.47;

}


long range_time;

void loop()
{
   increasepins();
  //publish the adc value every 50 milliseconds
  //since it takes that long for the sensor to stablize
     long duration, distance;
  digitalWrite(trigPin, LOW);  // Added this line
  delayMicroseconds(2); // Added this line
  digitalWrite(trigPin, HIGH);
//  delayMicroseconds(1000); - Removed this line
  delayMicroseconds(10); // Added this line
  digitalWrite(trigPin, LOW);
  distance = pulseIn(echoPin, HIGH)/ 58,2;
 

    range_msg.range = distance;
    range_msg.header.stamp = nh.now();
    range_time =  millis() + 50;
    range_msg.field_of_view = trigPin; 
    range_msg.min_range = echoPin;

  pub_range.publish(&range_msg);
  
  nh.spinOnce();
}
<commit_msg> small fix<commit_after>/* 
 * rosserial Ultrasound Example
 * 
 * This example is for the Maxbotix Ultrasound rangers.
 */

#include <ros.h>
#include <ros/time.h>
#include <sensor_msgs/Range.h>

#define sensNumber 3
#define firstTrigPin 3
#define firstEchoPin 9


ros::NodeHandle  nh;
sensor_msgs::Range range_msg;
ros::Publisher pub_range( "/ultrasound", &range_msg);
char frameid[] = "/ultrasound";

int trigPin=firstTrigPin;
int echoPin=firstEchoPin;

void increasepins(){
  trigPin++;
  echoPin++;
  if(trigPin>firstTrigPin+sensNumber){
    trigPin=firstTrigPin;}
  if(echoPin>firstEchoPin+sensNumber){
    echoPin=firstEchoPin;}
}

void setup(){
  nh.initNode();
  nh.advertise(pub_range);
  for(int i=0;i<sensNumber;i++){
   pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  increasepins();  
}
  range_msg.radiation_type = sensor_msgs::Range::ULTRASOUND;
  range_msg.header.frame_id =  frameid;
  range_msg.field_of_view = 0.1;  
  range_msg.min_range = 0.0;
  range_msg.max_range = 6.47;

}


long range_time;

void loop()
{
   increasepins();
  //publish the adc value every 50 milliseconds
  //since it takes that long for the sensor to stablize
     long duration, distance;
  digitalWrite(trigPin, LOW);  // Added this line
  delayMicroseconds(2); // Added this line
  digitalWrite(trigPin, HIGH);
//  delayMicroseconds(1000); - Removed this line
  delayMicroseconds(10); // Added this line
  digitalWrite(trigPin, LOW);
  distance = pulseIn(echoPin, HIGH)/ 58.2;
 

    range_msg.range = distance;
    range_msg.header.stamp = nh.now();
    range_time =  millis() + 50;
    range_msg.field_of_view = trigPin; 
    range_msg.min_range = echoPin;

  pub_range.publish(&range_msg);
  
  nh.spinOnce();
}

{'fraction_non_alphanumeric': 0.12663374963694451, 'fraction_numerical': 0.014522218995062446, 'mean_word_length': 4.26605504587156, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1744135', 'n_tokens_mistral': 1360, 'n_tokens_neox': 1253, 'n_words': 270}