nov 27 - hooking it all up
after a lot of experimentation I got everything hooked up to the arduino or to the raspberry pi. but thebig problem now is hooking it all up in parrallel and keeping it working. here is what i did in order:
as discussed before i put a pid controller and the motor driver onto the arduino. then i added a library that would use the serial port to communicate to the raspberry via the rosserial protocol. this also meant no more debgging output from the arduino. but i was able to see the motors node created in ros on the raspberry and could even remote control it via the teleop package in ros. this was promising.
then the ordeal started with hooking up the bno055 - i wanted it to eventually wake a sleeping arduino - hence i attached it to the arduino. the default is i2c but for whatever reason i2scanner and other examples did not find it. i checked the wiring, added smaller pull-up resistors to increase speed to no avail. so i hooked it up to another microcontroller that was 3.3v based - an esp8266. this worked right away but when i tried to hook this up via rosserial to the raspberry i did not get this to work althgouh i made sure on both sides to use 57600 baud. oh well. i then figured out, that after the arduino, the ydlidar sensor, the webcam and a potential usb lte stick i would not have any usb port available on the pi anymore out of the 4 available to hook up another microcontroller - so i had to hook up the bno055 with the pi or the arduino anyway. oh well.
i procrastinated and then went ahead hooking up the gps - starting with the pi. i could not hook it up to the arduino as there i still wanted to hook up the bno055 somehow and of the 4 individually addressable interrupt pins on a 32u4 2 were taken by the interrupts needed for the wheel encoders. using the serial port via uart (and not via usb) on the pi should have been easy but it was not. i had to follow instructions to switch the 2 uarts around between bluetooth and allowing to reach the console which took me 4 hours to get to work. then i added the bno055 to the arduino and for a reason i cannot tell it now worked - this was goode. but when i then tried rosserial again to at the same time see data coming from the arduino to the pi it did not work anymore where before it worked so well. the rosserial is hard to debug as you have no serial output. at this point i got really frustrated and decided to build up the pi image from scratch to get rosserial working first and then add the other options. on the pi side i also will build up the image much more carefully remembering each command with this help https://askubuntu.com/questions/80371/bash-history-handling-with-multiple-terminals and also documenting each command.
as a bottom line i think using an arduino mega where you have plenty of interrupt lines and 4 serial ports is better to hook up sensors which usually work out of the box with arduino. then use raspberry only for the usb based sensors and for bringing it all together. and then use logging available via rosserial for debugging the arduino sketch.