jhiggason / yahboomg1tank

ROS2 for YAHBOOM G1 Tank
https://opensar.net
MIT License
9 stars 0 forks source link

Mpu9250 #9

Open matt-desmarais opened 6 months ago

matt-desmarais commented 6 months ago

I got the kit today, should have it assembled tomorrow. I am going to try to add mpu9250 this weekend, I bitbanged an i2c on IR avoid left/right (12/17), ordered some xh245 wires. I found a couple ros2 mpu9250 examples on GitHub and will try to get working this weekend. If the examples work then adding that instead of one the empty IR slots may make sense. If it works then a different i2c sensor could probably be added to IR seek left/right.

jhiggason commented 6 months ago

Yay! I finally have some time off starting today so I'm working in this project and my common robotics platform project this weekend.

I have that mpu so maybe we can work on getting it working together.

matt-desmarais commented 6 months ago

Sounds good, some of my laser cut parts for the camera came damaged so I'm glueing them back together and will worry about that later. I am all set up otherwise and the turtle example works. Ill have the wires on Sunday the plan is to wire up the sensor, see if its detected, then run basic python program to make sure it works, then try the ros2 examples this is how to set up the i2c port (bus 3) on pins 12/17 /boot/firmware/config.txt dtoverlay=i2c-gpio,bus=3,i2c_gpio_sda=12,i2c_gpio_scl=17 CPP Example Python Example Wires I ordered

matt-desmarais commented 6 months ago

I looked it everything over again today and realized I made a mistake with the pins its Left Avoid (sda 12) and Left Seek (scl 7) for the i2c port. 4WD_ExpansionBoard_Yahboom_5_1100x https://github.com/YahboomTechnology/Raspberry-pi-G1-Tank/blob/master/05.SCH/4WD%20Exapansion%20Board%20Hardware%20interface%20quick%20reference%20manual.pdf

matt-desmarais commented 6 months ago

The MPU9250 is detected, I accidentally swapped sda/scl so I swapped them in the config.txt and it is good. The sensor works with a basic python program, I am going to try the ros2 example programs, I think the only thing that needs to be changed in them is the bus from 1 to 3. PXL_20231224_175208136 MP

jhiggason commented 6 months ago

Hey I'm looking over all this stuff again. The last update I made to the ROS2 stuff was incorporating a YAML config file. The yaml file is located under params_pkg/params/robot_params.yaml and a change needs to be made to the tank control package so it works in your enviornment. This line in the tank_control_pkg/tank_control_pkg/tank_control.py file needs line 88 change to your environment : self.config = self.load_yaml_config("/home/jeffh/ros2_ws/src/params_pkg/params/robot_params.yaml")

In my case you can see my home folder is jeffh, that is probably what needs to be changed on yours as well. I still need to figure out a way to do this without having to change this variable.

jhiggason commented 6 months ago

Looks like the same needs to be changed for the robot_peripherals_pkg.py as well. Line 19 self.config = self.load_yaml_config("/home/jeffh/ros2_ws/src/params_pkg/params/robot_params.yaml")

Aspectcarl commented 5 months ago

Yes i found this issue as well, when i get back home in a couple of weeks i will follow this guidance.