okalachev / vl53l1x_ros

STM VL53L1X rangefinder driver for ROS
BSD 3-Clause "New" or "Revised" License
31 stars 20 forks source link

ubuntu 20.04 i2c failed #11

Closed lurunawjan closed 2 years ago

lurunawjan commented 2 years ago

Hello, i have problem with the I2c in ubuntu. I'm using raspberry pi4 with ubuntu 20.04 and make connection for sensor using I2c in raspberry pi. then i got the error at the terminal said that "failed to open I2c bus 1" is there anyone know how to solve this problem. I really need help since I need to solve it urgently. Thank you

okalachev commented 2 years ago

Hi!

You may try to debug your I2C bus using i2c-tools.

Get list of I2C busses - i2cdetect -l:

i2c-1   i2c             bcm2835 (i2c@7e804000)                  I2C adapter

Get list of devices on the bus 1 - i2cdetect -y 1:

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- 29 -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --          

You can see the device with address 0x29, which is the rangefinder.

lurunawjan commented 2 years ago

Thank you for your reply. I manage to solve the problem. Since I'm new with ROS I wanted to ask how can I use the sensor with rviz? Thank you

okalachev commented 2 years ago

Run rviz on your computer with pointing ROS_MASTER_URI to your RPi's hostname; add /vl53l1x/range topic visualization.

Some more info here: https://clover.coex.tech/en/rviz.html#start-rviz

lurunawjan commented 2 years ago

I tried to use that but why it said that for frame [] fixed frame [map] does not exist

okalachev commented 2 years ago

In ROS, in order to visualize the sensor data each sensor should declare its pose in space (most often relative to the robot's body), using a TF frame. Please, address the main TF documentation to learn details.

By default, the driver publishes an empty frame (header.frame_id = ""), so you should configure it manually in the launch-file.

The simplest way to see something is to put any string you want there (e. g. rangefinder) and set it as the rviz fixed frame name.