I2c device open failed
Hi all,
I follow a tutorial in interfacing BNO055 sensor.
It was connected to my Odroid C4 via SCL (pin 5) and SDA (pin 3) and also 3.3V & Gnd.
Ran command sudo i2cdetect -r -y 0
returns shows the address to be 0x29.
Ran the launch file and errors showed up.
PARAMETERS
* /imu/imu_node/address: 40
* /imu/imu_node/device: /dev/i2c-0
* /imu/imu_node/frame_id: imu
* /rosdistro: noetic
* /rosversion: 1.15.14
setting /run_id to 159765cc-9bc4-11ec-b5b8-001e06489d9b
process[rosout-1]: started with pid [6737]
started core service [/rosout]
process[imu/imu_node-2]: started with pid [6744]
terminate called after throwing an instance of 'std::runtime_error'
what(): i2c device open failed
[imu/imu_node-2] process has died [pid 6744, exit code -6, cmd /home/odroid/catkin_ws/devel/lib/imu_bno055/bno055_i2c_node __name:=imu_node __log:=/home/odroid/.ros/log/159765cc-9bc4-11ec-b5b8-001e06489d9b/imu-imu_node-2.log].
log file: /home/odroid/.ros/log/159765cc-9bc4-11ec-b5b8-001e06489d9b/imu-imu_node-2*.log
I have already edited the launch file, changing the device path to /dev/i2c-0
and also the address to 0x29
.
Thank you.
Answer:
For i2c device open failed
, run command sudo chmod 666 /dev/i2c-0
For incorrect chip id
,Change the launch file address to
<launch>
<node ns="imu" name="imu_node" pkg="imu_bno055" type="bno055_i2c_node" respawn="true" respawn_delay="2">
<param name="device" type="string" value="/dev/i2c-0"/>
<param name="address" type="int" value="41"/> <!-- 0x29 == 40 is the default for BNO055 -->
<param name="frame_id" type="string" value="imu"/>
</node>
</launch>
*0x29 is 41 and 0x28 is 40
anyone please?