I’m looking to implement a magnetic track sensor and track following capability, and want to do a little legwork before I ask our coder to dig in.
The sensor has a multitude of outputs, PWM, CAN, analog 3v, serial packet, etc. I’ve always been unclear if a Cube has PWM input capability on the Aux PWM output pins. So my guess is if PWM input is avail, that would be the easiest, followed by analog and then serial.
Then beyond that, I’m guessing we will have to generate a new flight mode, but base it on an existing mode. The modes designed for external input seem more geared for a more complex heading input, rather than just a simple PWM “steering wheel” input (which was the intended implementation from Roboteq)
Anybody have any thoughts on this?
The Pixhawk flight controllers can accept a PWM input on the auxiliary channels. The RSSI library’s pwm input is perhaps a good reference showing how this can be done.
yes, i think adding a new flight mode will be required. I guess in this mode the pilot would control the throttle directly or perhaps they would control the speed. Acro mode might be good to look at because it shows how to use direct throttle control if there’s no position sensor (i.e. GPS) but speed control when there is. For steering, perhaps the pilot controls the steering directly if there is no magnetic strip detected, otherwise it uses some kind of algorithm (a P controller?) to get the vehicle on the line. I suppose if the line forks the pilot should be able to decide which fork to follow using the steering input.
If it were me I would probably write a new library/driver for this type of sensor which return where the strip is detected (as a percentage?). I would try and separate the sensor reading part from the control part.
Anyway, hope this helps
By the way, we have an existing issue which is perhaps similar to this request. It looks like a number of people thought about giving a go but perhaps it was a bit tougher than they thought.
Thanks very much, Randy. I was hoping somebody would be able to direct me to some more discussion on this.
While not trivial, it looks like it can be done and confirmation that we can use PWM will help tremendously. I swear, I searched before I asked about the PWM!
The discussion and your suggestuionwhere PWM is converted to a -100/+100 hotter colder in a driver seems like the way to go.
I can’t code, but if I can save my guy some legwork by explaining the architecture and direct him to the cpps involved, I can save him a lot of time!