Jump to content


Remapping a PWM output as independent PWM input


  • Please log in to reply
2 replies to this topic

#1 psupine

psupine

    Key Member

  • Members
  • PipPipPip
  • 126 posts
  • LocationBrisbane
  • Country: flag of Australia Australia


Posted 12 November 2011 - 11:23 AM

This is a variation on jes1111's recent thread on remapping input channels as outputs.

I think I read that someone has done this on their own branch, but I'm interested in remapping one of the outputs as an additional input (on the CC).

I bought myself one of the little ultrasound modules with the aim of using it to look at the the height above ground and collision avoidance problems. That is, using the one sensor mounted to the same pitch pivoting plane as the FPV camera, with two modes,
- look ahead level for normal flight and collision avoidance
- look down for landing with height assisted landing/takeoff

or one mode,
- look ahead level for FPV but with height control, for nap of the earth kind of flying.

The ultrasound module supports UART, analog output and PWM. It would be kinda nice to use the PWM signalling because it then looks like other inputs and I'm imagining the serial ports being otherwise engaged chatting with OSD or GPS. The thing is that the PWM period would be 20Hz so it couldn't share timer resources with the other 50Hz input channels.

I could wade through lots of code trying to figure this out and I might yet be doing that, but I thought it might speed things up if I simply asked the older heads whether this sounds like a reasonable approach.

Or are we simply so hard up against the memory limits that it ain't worth pursuing.

#2 Kenn Sebesta

Kenn Sebesta

    Controls Master!

  • Members
  • PipPipPip
  • 896 posts
  • Country: flag of Luxembourg Luxembourg


Posted 21 November 2011 - 08:38 PM

It's been a while since you asked this, so even if I don't have all the answers I'll try to take a stab.

1) Last I knew, the amount of free RAM on the CC is measured in bytes. There's really not a lot going around, so you have to be careful.
2) You might look at http://forums.openpi...urrent-monitor/, since the approach of getting the sensor data into CC will be generic.

3) I think you'll have to get into the code to start adding additional autonomy. I don't know of anyone that has written a generic module for taking in senor data and is using it for control purposes.

#3 psupine

psupine

    Key Member

  • Members
  • PipPipPip
  • 126 posts
  • LocationBrisbane
  • Country: flag of Australia Australia


Posted 22 November 2011 - 05:51 AM

Thanks Kenn for taking a stab. I'd stopped even checking my own topic :)

Mostly what I want to replicate is the Parrot's noob friendly landing. I know I'm new to RC and all but I *still* usually break something when I land and it's fairly off pissing.

I believe that the Pro will have altitude stablisation via a pressure sensor input, so altitude will be part of the control loop state vector at some point. I was planning to try to inject the ultrasound "height above ground data" into it by faking the altitude feed, and lever off either the PWM code of ADC code to read my sensor.

Yes I was asking for a short cut but a large part of the reason for asking was to avoid crossing paths with some higher dev plan, creating orphan code in the process. I'll just read the code base, but I haven't had the time to get into of it of late anyway.