Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] PMW3901 page (optical flow) #559

Closed

Conversation

DanielePettenuzzo
Copy link

In PX4 we are now supporting several optical flow boards based on the PMW3901 sensor:

  • Bitcraze and Tindie (SPI)
  • Hex (UAVCAN)
  • Trone (UART) --> work in progress

The goal of this page is to compare the 4 types of boards and then to be able to use the selected one with PX4.

This is not finished. The page still has the PX4FLOW youtube video because I'm trying to find some PMW3901 videos that I took a few months ago. The diagrams are hand made by me and can be improved.

FYI @hamishwillee @jkflying @mhkabir

@DanielePettenuzzo
Copy link
Author

TODO before merging:

  • find decent youtube video
  • add some sensor specifications
  • update voltages and sizes in the main table
  • add orientation diagrams (I need to verify these with @jkflying because I don't remember)
  • add troubleshooting if we can think of anything useful

@DanielePettenuzzo
Copy link
Author

Moreover I'm not sure if the small module from TIndie is actually designed by them. We need to check this to put the right name of the manufacturer

@TSC21
Copy link
Member

TSC21 commented Aug 18, 2019

@DanielePettenuzzo in terms of cabling and adaptors: you have schematics for connecting on the Pixhawk 4. My question is, from these sensors, which ones do require some specific wiring and buy out adaptor plugs to connect to the Pixhawk 4 pins? Or do they bring already the required cabling? That should be something to be documented as that would help people understand if they need to buy extra plugs and cabling to connect it to the Flight Controller.

@DanielePettenuzzo
Copy link
Author

And we recently made changes to the pixracer board config to be able to get a SPI port on the WIFI port. We should also add a small section about this because it's a very small (in terms of size) setup.

@DanielePettenuzzo
Copy link
Author

@TSC21 except for the HEX uavcan module I think the other 3 don't come with the wire and the user will have to solder a cable for it. Yes I agree that we need to specify this

@hamishwillee
Copy link
Collaborator

# PMW3901 Flow Sensor

PMW3901 is an [optical flow](../sensor/optical_flow.md) asic that computes the flow internally and provides a difference in pixels between
each frame over a SPI interface. It is basically a tracking sensor similar to what you would find in a computer mouse, but adapted to work between
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"an SPI" (FYI, the rule in English is that the "an" is used before word that sounds like it has a vowel first. So "an esssPI").

# PMW3901 Flow Sensor

PMW3901 is an [optical flow](../sensor/optical_flow.md) asic that computes the flow internally and provides a difference in pixels between
each frame over a SPI interface. It is basically a tracking sensor similar to what you would find in a computer mouse, but adapted to work between
Copy link
Collaborator

@hamishwillee hamishwillee Aug 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

People do search on component part numbers, but they just as much (or more) look for products. So it is worth highlighting the relevant products as early as possible.

I know you have a list below, so we could forward reference it - e.g. after the sentence ending in "SPI interface" have another one. The PMW3901 is used in a number of products including Bitcraze, x, y, z - see full listing below.


### Bitcraze

The Bitcraze optical flow module exposes directly the SPI interface from the PMW3901 module. The board also has a distance sensor that can be wired via I2C. This distance sensor is the VL53L0x ToF sensor for STMicroelectronics. The range of the sensor is very limited (2 meters) and will be reduced when flying in the sunlight. We therefore highly recommend to use another external distance sensor. This board was mainly tested with the [Lidar Lite V3](../sensor/lidar_lite.md) on larger vehicles and with the [Lanbao CM8JL65](../sensor/cm8jl65_ir_distance_sensor.md) on smaller vehicles.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not essential, but consider putting each sentence on a new line. Makes things slightly easier for translators.


### Bitcraze

The Bitcraze optical flow module exposes directly the SPI interface from the PMW3901 module. The board also has a distance sensor that can be wired via I2C. This distance sensor is the VL53L0x ToF sensor for STMicroelectronics. The range of the sensor is very limited (2 meters) and will be reduced when flying in the sunlight. We therefore highly recommend to use another external distance sensor. This board was mainly tested with the [Lidar Lite V3](../sensor/lidar_lite.md) on larger vehicles and with the [Lanbao CM8JL65](../sensor/cm8jl65_ir_distance_sensor.md) on smaller vehicles.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for or "from" STMicroelectronics?


### Bitcraze

The Bitcraze optical flow module exposes directly the SPI interface from the PMW3901 module. The board also has a distance sensor that can be wired via I2C. This distance sensor is the VL53L0x ToF sensor for STMicroelectronics. The range of the sensor is very limited (2 meters) and will be reduced when flying in the sunlight. We therefore highly recommend to use another external distance sensor. This board was mainly tested with the [Lidar Lite V3](../sensor/lidar_lite.md) on larger vehicles and with the [Lanbao CM8JL65](../sensor/cm8jl65_ir_distance_sensor.md) on smaller vehicles.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is a reasonable range/good range for a distance sensor?

The Hex optical flow module is a very small board containing the PMW3901 flow module, the VL53L1X distance sensor and an IMU to better synchronize the flow data with the gyro data. These three sensors are then sampled by a microcontroller onboard. The goal of the microcontroller is to then expose 2 UAVCAN messages containing all the necessary data.

This board can be connected to the CAN port on any Pixhawk board. All tests were performed connecting it to the CAN1 port on a Pixhawk 4. Differently from the other sensors, this one needs UAVCAN running on PX4. To enable UAVCAN you will have to set the UAVCAN_ENABLE parameter to 2 (if you have have UAVCAN sensors but no motor controllers) or to 3 (if you have also your motor controllers on CAN).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I use an external distance sensor, is there anything special I need to do to make sure that PX4 properly fuses the external one rather than using the inbuilt one that comes with UAVCAN message?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure anymore. I need to check this one

@hamishwillee
Copy link
Collaborator

hamishwillee commented Aug 18, 2019

This is a great start at getting the information and makes it very easy to compare the different options.

The problem for me is that this doesn't quite fit into the existing docs structure. My thinking is that generally you want to be able to look at the to level optical flow page to get a good idea of the options and any common setup, then drill down to more detail. The detail pages then link back up to the top page for the common setup. The reason that works is that it is obvious how you extend when new things come along

So what I'd kind of like to do is pull this apart.

  • The top part of this current page would go under cameras here - this would include the comparison information, general setup, general calibration
  • Each of the different flow products would get their own pages that contains wiring diagrams, specifications, link to general setup info in top level page (e.g. EKF2 params) and specific PX4 setup for this device - e.g. UAVCAN setup etc, specific calibration.

Does that make sense?


### Thone
WORK IN PROGRESS

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've also tested this board, the Alientek atk-PMW3901 https://www.aliexpress.com/i/32979605707.html
Had to reverse-engineer some pinouts, only trust the SPI pinouts and V+/GND

image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkflying Further down your linked page they had this:
image

Does that help you with the missing pins?

Copy link
Contributor

@jkflying jkflying Sep 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are the pins on the parent board this is mounted to, and reflect the labels of the schematic/microcontroller on the other side. There are a bunch of CS lines for example, I had to trace the circuit board to figure out which one is the real one on this board. Other pins like the VCC and the VUSB they have don't work as power supplies.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I've sorted by just showing the SPI pins in the connection diagram in other doc. Have included your doc too "for the moment".

@jkflying
Copy link
Contributor

It would be good to mention the orientation of the sensor for the SENS_FLOW_ROT parameter. On the direct-access SPI devices this has the notch in the chip housing facing backwards when SENS_FLOW_ROT = 0.

I'm not sure if the Thone or other boards change this.

image

@hamishwillee
Copy link
Collaborator

It would be good to mention the orientation of the sensor for the SENS_FLOW_ROT parameter. On the direct-access SPI devices this has the notch in the chip housing facing backwards when SENS_FLOW_ROT = 0.

@jkflying Can you confirm that you saying zero rotation is when the board is aligned on the vehicle with that notch facing the back? ie

image

Is this the recommended rotation? (for PX4FLOW the recommendation is 270)

@jkflying
Copy link
Contributor

Can you confirm that you saying zero rotation is when the board is aligned on the vehicle with that notch facing the back?

Yes

Is this the recommended rotation? (for PX4FLOW the recommendation is 270)

I don't think it has a 'recommended' orientation. Any should work fine, as long as SENS_FLOW_ROT is correct.

@hamishwillee
Copy link
Collaborator

@DanielePettenuzzo Can you address the comments/questions please?

@DanielePettenuzzo
Copy link
Author

@hamishwillee regarding the SENS_FLOW_ROT being default to 270 for the PX4 Flow this is because with this rotation the forward facing arrow that is drawn on the module will be aligned with the orientation of the autopilot.

@DanielePettenuzzo
Copy link
Author

@hamishwillee I addressed all your questions/comments and pushed a new commit. I still didn't change the structure since I was super busy lately. Would you have time to change the structure to what you think is best and then I can go in and add all the missing parts.

@hamishwillee
Copy link
Collaborator

@DanielePettenuzzo Thanks very much. I don't think I can alter structure while it is on your repo - can you push to this repo and change what the PR is comparing? Then yes, I can play with this!

@DanielePettenuzzo
Copy link
Author

replaced by: #580

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants