Ask Your Question

ARUN T S's profile - activity

2019-05-20 01:48:01 -0600 marked best answer hi am using Arduino Mega with LIDAR Lite V3 to create a map but it get restaring after some time

`

`#define USB_USBCON
   #define    LIDARLite_ADDRESS   0x62        
 #define    RegisterMeasure     0x00         
#define    MeasureValue        0x04        
#define    RegisterHighLowB    0x8f         
#include <ros.h>
#include <Wire.h>
#include <LIDARLite.h>
#include <I2C.h>
#include <sensor_msgs/Range.h>
#include <sensor_msgs/LaserScan.h>
#include <std_msgs/UInt16MultiArray.h>
#include <std_msgs/Int16MultiArray.h>
#include <Timer.h>
LIDARLite myLidarLite;
#include <Servo.h>
float pos;
int i;
Servo myservo;
ros::NodeHandle  nh;
sensor_msgs::LaserScan scan;
ros::Publisher pub_range( "scan", &scan);
float ranges[100];
char frameid[] = "/base_link";
float lidarGetRange(void)
  {
int val = -1;
Wire.beginTransmission((int)LIDARLite_ADDRESS); // transmit to LIDAR-Lite
Wire.write((int)RegisterMeasure); // sets register pointer to  (0x00)  
Wire.write((int)MeasureValue); // sets register pointer to  (0x00)  
Wire.endTransmission(); // stop transmitting
delay(20); // Wait 20ms for transmit
Wire.beginTransmission((int)LIDARLite_ADDRESS); // transmit to LIDAR-Lite
Wire.write((int)RegisterHighLowB); // sets register pointer to (0x8f)
Wire.endTransmission(); // stop transmitting
delay(20); // Wait 20ms for transmit
Wire.requestFrom((int)LIDARLite_ADDRESS, 2); // request 2 bytes from LIDAR-Lite
 if(2 <= Wire.available()) // if two bytes were received
 {
val = Wire.read(); // receive high byte (overwrites previous reading)
val = val << 8; // shift high byte to be high 8 bits
val |= Wire.read(); // receive low byte as lower 8 bits
 }
  return val;
}
void setup()
{
nh.getHardware()->setBaud(74880);
Serial.begin(74880);
nh.initNode();
delay(1000);
nh.advertise(pub_range);
myLidarLite.begin(0, true);
myLidarLite.configure(0);
scan.header.stamp=nh.now();
scan.ranges_length=100;
scan.ranges= ranges;
myservo.attach(9);
 }
void loop()
 {
   for(i = 0,pos=0; i<100,pos<=180; i++,pos=pos+1.8)
   {
   scan.header.frame_id =  frameid;
   scan.angle_max= 3.14;
   scan.angle_min= 0; 
   scan.scan_time=0.0381;
   scan.angle_increment =0.0314; 
   scan.time_increment=0.039;
   scan.range_min = 0;  
   scan.range_max = 40000; 
   ranges[i] =lidarGetRange()/100;
   scan.ranges[i] =ranges[i];
   pub_range.publish(&scan);
   myservo.write(pos);
    }
  nh.spinOnce();
    }

Initially it works fine but after some time it shows error, Error is like

   [ERROR] [1510517471.428006]: Lost sync with device, restarting...

and while it restarting it also stops the servo

also tried various baud rates

2019-05-20 01:28:07 -0600 marked best answer How can i make ros IOT capable?

I want to sent my sensor readings to another pc using cloud, Is it possible in ROS ?

2019-05-20 01:27:46 -0600 received badge  Famous Question (source)
2019-05-20 01:27:46 -0600 received badge  Notable Question (source)
2018-09-14 17:19:59 -0600 marked best answer I am planning to publish sensor data over wifi module(ESP8266-01) through arduino. In my program it created a access point but it is not sending any data
#include <SoftwareSerial.h>
#include <SerialESP8266wifi.h>
#include <ros.h>
#include <sensor_msgs/Range.h>
#define sw_serial_rx_pin 12 //  Connect this pin to TX on the esp8266
#define sw_serial_tx_pin 11 //  Connect this pin to RX on the esp8266
 #define esp8266_reset_pin 5 // Connect this pin to CH_PD on the esp8266, not reset. (let reset be unconnected)
 SoftwareSerial swSerial(sw_serial_rx_pin, sw_serial_tx_pin); 
SerialESP8266wifi wifi(swSerial, swSerial, esp8266_reset_pin, Serial);//adding Serial enabled local echo and wifi debug
ros::NodeHandle nh;
sensor_msgs::Range range_msg;
ros::Publisher pub_range("car", &range_msg);
char ultrafrid[] = "/ultrasound";
void setup() {
swSerial.begin(9600);
Serial.begin(9600);
nh.initNode();
nh.advertise(pub_range);
while (!Serial)
Serial.println("Starting wifi");
wifi.setTransportToTCP();
wifi.endSendWithNewline(true); 
wifi.connectToAP("wifissid", "wifipass");
wifi.connectToServer("192.168.4.255", "11411");
wifi.send(SERVER, "ESP8266 test app started");
nh.initNode();
nh.advertise(pub_range);
range_msg.header.frame_id =  ultrafrid;   // ultrasound frame id
range_msg.field_of_view = 0.1;
range_msg.min_range = 0.0;
range_msg.max_range = 20;
}
void loop() {
 if (!wifi.isStarted())      //Make sure the esp8266 is started..
wifi.begin();
for(int i=0;i<5;i++)
{      range_msg.range = i;
}

 pub_range.publish(&range_msg);

nh.spinOnce();
}
2018-06-27 02:48:35 -0600 received badge  Famous Question (source)
2018-04-11 16:15:35 -0600 received badge  Famous Question (source)
2018-03-19 02:54:46 -0600 received badge  Popular Question (source)
2018-03-18 14:42:28 -0600 asked a question How can i make ros IOT capable?

How can i make ros IOT capable? I want to sent my sensor readings to another pc using cloud, Is it possible in ROS ?

2018-03-05 21:16:55 -0600 received badge  Famous Question (source)
2018-03-05 21:16:39 -0600 received badge  Famous Question (source)
2018-02-08 10:27:30 -0600 received badge  Notable Question (source)
2018-01-08 23:56:16 -0600 received badge  Notable Question (source)
2017-12-30 11:04:31 -0600 received badge  Popular Question (source)
2017-12-29 10:56:13 -0600 received badge  Organizer (source)
2017-12-29 10:53:58 -0600 asked a question I am planning to publish sensor data over wifi module(ESP8266-01) through arduino. In my program it created a access point but it is not sending any data

I am planning to publish sensor data over wifi module(ESP8266-01) through arduino. In my program it created a access poi

2017-12-26 13:31:21 -0600 received badge  Popular Question (source)
2017-11-12 14:42:04 -0600 edited question hi am using Arduino Mega with LIDAR Lite V3 to create a map but it get restaring after some time

hi am using Arduino Mega with LIDAR Lite V3 to create a map but it get restaring after some time ` `#define USB_USBCON

2017-11-12 14:33:05 -0600 edited question hi am using Arduino Mega with LIDAR Lite V3 to create a map but it get restaring after some time

hi am using Arduino Mega with LIDAR Lite V3 to create a map but it get restaring after some time ` `#define USB_USBCON

2017-11-12 14:21:48 -0600 edited question hi am using Arduino Mega with LIDAR Lite V3 to create a map but it get restaring after some time

hi am using Arduino Mega with LIDAR Lite V3 to create a map but it get restaring after some time ` `#define USB_USBCON

2017-11-12 14:18:36 -0600 edited question hi am using Arduino Mega with LIDAR Lite V3 to create a map but it get restaring after some time

hi am using Arduino Mega with LIDAR Lite V3 to create a map but it get restaring after some time define USB_USBCON #

2017-11-12 14:18:12 -0600 edited question hi am using Arduino Mega with LIDAR Lite V3 to create a map but it get restaring after some time

hi am using Arduino Mega with LIDAR Lite V3 to create a map but it get restaring after some time define USB_USBCON #

2017-11-12 14:16:19 -0600 edited question hi am using Arduino Mega with LIDAR Lite V3 to create a map but it get restaring after some time

hi am using Arduino Mega with LIDAR Lite V3 to create a map but it get restaring after some time define USB_USBCON #

2017-11-12 14:14:43 -0600 asked a question hi am using Arduino Mega with LIDAR Lite V3 to create a map but it get restaring after some time

hi am using Arduino Mega with LIDAR Lite V3 to create a map but it get restaring after some time #define USB_USBCON

2017-11-05 01:49:28 -0600 marked best answer Hi, i canot publish an array to ros from arduino ide.

enter code here

#include <ros.h>
#include <Wire.h>
    #define    LIDARLite_ADDRESS   0x62         
    #define    RegisterMeasure     0x00         
    #define    MeasureValue        0x04       
    #define    RegisterHighLowB    0x8f         
    #define USB_USBCON
    #include <LIDARLite.h>
    #include <I2C.h>
    #include <sensor_msgs/Range.h>
    #include <sensor_msgs/LaserScan.h>
     LIDARLite myLidarLite;
     ros::NodeHandle  nh;
     sensor_msgs::LaserScan scan;
     ros::Publisher pub_range( "lidar", &scan);
     float ranges[7];
      char frameid[] = "/my_frame";
     int lidarGetRange(void) 
     {
     int val = -1;
     Wire.beginTransmission((int)LIDARLite_ADDRESS); 
     Wire.write((int)RegisterMeasure); 
     Wire.write((int)MeasureValue);   
     Wire.endTransmission(); 
      delay(20); 
     Wire.beginTransmission((int)LIDARLite_ADDRESS);
     Wire.write((int)RegisterHighLowB); 
     Wire.endTransmission(); 
     delay(20); 
     Wire.requestFrom((int)LIDARLite_ADDRESS, 2);
     if(2 <= Wire.available()) 
     {
     val = Wire.read(); 
     val = val << 8; 
     val |= Wire.read();
      }
      return val;
      }
     void setup()
      {
     Serial.begin(57600);
    nh.initNode();
    nh.advertise(pub_range);
    //delay(1000);
     myLidarLite.begin(0, true);
    myLidarLite.configure(0);
    scan.header.frame_id =  frameid;
    scan.angle_min= 0; 
     scan.angle_max= 3.14;
    scan.angle_increment =1; 
    scan.range_min = 0.03;  
    scan.range_max = 4000; 
          } 
     void loop()
      {
     for(int i = 0; i < 7; i++)
         {
      Serial.println(lidarGetRange());
      scan.ranges[i] =lidarGetRange();   
       pub_range.publish(&scan);
         }
        nh.spinOnce();
      }`
2017-11-05 01:49:28 -0600 received badge  Scholar (source)
2017-11-04 11:17:44 -0600 commented answer Hi, i canot publish an array to ros from arduino ide.

I really appreciate your help But am Getting one more error when i increased loop condition to 200(i<200) it's like

2017-11-03 13:00:45 -0600 commented question Hi, i canot publish an array to ros from arduino ide.

That's it, Thank you gvhoorn , and i also have to remove delay

2017-11-03 12:58:14 -0600 edited question hi am trying create a map using lidat lite v3 through arduino,but it is not producing any map,my program is written below, can you guys please help me ? am new to ROS

hi am trying create a map using lidat lite v3 through arduino,but it is not producing any map,my program is written belo

2017-11-02 08:59:42 -0600 received badge  Notable Question (source)
2017-11-02 07:54:17 -0600 commented question Hi, i canot publish an array to ros from arduino ide.

Getting error message when i tries to establish serial publication between arduino and ros [ERROR] [1509616280.864411]:

2017-11-02 07:53:34 -0600 commented question Hi, i canot publish an array to ros from arduino ide.

Getting error message when i tries to establish serial publication between arduino and ros [ERROR] [1509616280.864411]:

2017-11-02 07:53:03 -0600 commented question Hi, i canot publish an array to ros from arduino ide.

Getting error message when i tries to establish serial publication between arduino and ros

2017-11-02 07:52:39 -0600 commented question Hi, i canot publish an array to ros from arduino ide.

Getting error message when i tries to establish serial publication between arduino and ros but when i remove the for lo

2017-11-02 07:31:25 -0600 commented question Hi, i canot publish an array to ros from arduino ide.

Getting error message when i tries to establish serial publication between arduino and ros but when i remove the for lo

2017-11-02 07:06:25 -0600 answered a question hi am trying create a map using lidat lite v3 through arduino,but it is not producing any map,my program is written below, can you guys please help me ? am new to ROS

I Got the answer. The problem was with array.I had to allocate array scan.ranges= ranges;

2017-11-02 05:40:41 -0600 received badge  Enthusiast
2017-10-31 09:02:57 -0600 received badge  Notable Question (source)
2017-10-31 06:03:49 -0600 commented question Hi, i canot publish an array to ros from arduino ide.

i edited my question ,this is my full program, can u guys find out what is the error in my program? am trying to create

2017-10-31 06:01:49 -0600 edited question Hi, i canot publish an array to ros from arduino ide.

Hi, i canot publish an array to ros from arduino ide. enter code here #include <ros.h> #include <Wire.h>

2017-10-31 06:00:50 -0600 edited question Hi, i canot publish an array to ros from arduino ide.

Hi, i canot publish an array to ros from arduino ide. include <ros.h> #include <Wire.h> #define LIDA

2017-10-31 06:00:13 -0600 edited question Hi, i canot publish an array to ros from arduino ide.

Hi, i canot publish an array to ros from arduino ide. include <ros.h> #include <Wire.h> #define LIDA

2017-10-31 05:59:41 -0600 edited question Hi, i canot publish an array to ros from arduino ide.

Hi, i canot publish an array to ros from arduino ide. include <ros.h> #include <Wire.h> #define LIDA

2017-10-31 05:59:07 -0600 edited question Hi, i canot publish an array to ros from arduino ide.

Hi, i canot publish an array to ros from arduino ide. include <ros.h> include <wire.h> #define LIDARLit

2017-10-30 02:17:43 -0600 received badge  Popular Question (source)
2017-10-29 00:56:24 -0600 asked a question Hi, i canot publish an array to ros from arduino ide.

Hi, i canot publish an array to ros from arduino ide. plz help for(int i = 1; i<5; i++) { long b=lidarGetRange();

2017-10-28 02:21:09 -0600 commented question hi am trying create a map using lidat lite v3 through arduino,but it is not producing any map,my program is written below, can you guys please help me ? am new to ROS

i think it is a problem related to arrays

2017-10-27 13:34:33 -0600 commented question hi am trying create a map using lidat lite v3 through arduino,but it is not producing any map,my program is written below, can you guys please help me ? am new to ROS

i donot have any idea why it is not working ,am planning to use hector mapping for the mapping

2017-10-27 12:23:30 -0600 commented question hi am trying create a map using lidat lite v3 through arduino,but it is not producing any map,my program is written below, can you guys please help me ? am new to ROS

sorry about that,i formatted my question