Teensy 4.0 as a slave

I want to use opencv a n the raspi to guide my robot (color detection) and relay some info to the teensy that control the motors
 
Color detection?
And you also have a RasPi?

Why do you absolutely insist on making your project more complicated than it needs to be?
The Teensy 4.x is comparable to an RPi Zero in processing power, but without the wasted cycles of a large OS.
And here are Real-time OSes available for Arduino and Teensy.
 
It may also depend on your whole setup.

For example with earlier ROS, I know some Arduino devices were setup to handle a ROS topic or two using ROS Serial support...

With ROS2, I know that some Arduino devices could be setup to work over Ethernet or the like as independent ROS nodes.

At one point I was playing around with some of the stuff with Robotis boards and their XEL setup and the like.
For example there is their library: https://github.com/ROBOTIS-GIT/ros2arduino

Where for example on a Turtlebot3 the OpenCR board can work as a nodes. I have not looked in awhile to know if it requires Ethernet or if there are other forms of IO that is now supported.
 
Perhaps you want to use the Teensy to control the motors because you have found a way to do it, and you don't know how to achieve the same effect on the Pi, and the project taxes your current skill level enough that you prefer to do it this way. That is perfectly valid. Or, perhaps you simply want to split the motor control to the Teensy because you want to learn from figuring out how to get it to communicate with the Pi. That is also perfectly valid.

However: If the goal is only to get something up and running, the Pi can do this itself. It has enough GPIO, and the CPU need only spend a tiny fraction of its resources on motor control compared to computer vision. If you want to do this in the easiest way possible, get a motor shield for the Pi, and have it do both vision and motor control.

As for the #include problem, you will probably get better advice on a Pi-specific forum. When asking for such help, you really need to include both the source code and the error you got.
 
Back
Top