-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
tfmini fixes #8726
tfmini fixes #8726
Conversation
mainly the default device path doesn't work
This makes sure the driver fails if the device path is invalid (::open fails)
797d9a1
to
ed69e63
Compare
// designated SERIAL4/5 on Pixhawk | ||
#define TFMINI_DEFAULT_PORT "/dev/ttyS6" | ||
#define NAME "tfmini" | ||
#define DEVICE_PATH "/dev/" NAME |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are different things.
/dev/tfmini
is the px4 device driver (created by this module).
/dev/ttyS6
or whatever needs to be the physical serial port.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the case, isn't it? It is not directly replacing it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry you're right, I should really stop trying to view diffs on my phone. There's no default port then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hehe, no worries :) Yes, there's no default port anymore. I think it makes no sense to have one if it's different on every board
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's wrong with defaulting to RANGE_FINDER0_DEVICE_PATH and letting the command line override?
if ver hwcmp PX4FMU_V3 | ||
then | ||
# start the driver on serial 4/5 | ||
tfmini start -d /dev/ttyS6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do this more generically? There are way too many variants now to maintain these special cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know... But I can't think of anything... On every board, it's different and we would need to link it to https://github.com/ChristophTobler/Firmware/blob/master/ROMFS/px4fmu_common/init.d/rcS#L641-L672 as most boards need to use this device path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, I'll see if I can come up with something in the near future. #8302
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChristophTobler So based on this, is the documentation here accurate? It looks like the TFmini is only automatically started on Pixhawk FMUv3 (but not before or later) ... right?
If that is the case then should we not link to instructions for enabling on other boards - i.e. instructions on how to add a driver to a config and how to start/stop the driver and specify the port to watch?
- Will the changes you propose in generalize serial port configuration #8302 make enabling sensors consistent and generic? I'm envisaging that you would set SENS_EN_TFMINI with the value of the port you wanted to use ... and ideally that this setting would automatically disable any other thing that is trying to use the port.
- Do you know what we need to do to create module docs (like this for tfmini? That would allow me to have somewhere to link to for "using the driver" instructions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure how to structure it. Configuring a parameter per serial port is a little more straightforward, but it's less modular. Parameters to enable per device are relatively easy, and keeps it separate, but what happens if you configure a conflict? Who takes priority?
I believe all of that documentation is generated from the module itself and Tools/px_process_module_doc.py https://github.com/PX4/Firmware/blob/master/src/drivers/px4fmu/fmu.cpp#L3394
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dagar Plug'n'play would be nice :-). I understand your dilemma and there is no easy solution. My "docs" point of view is that it doesn't matter as long as we're completely consistent. Personally though I'd go for the less-modular per-serial port option because debugging conflicts would be a pain. Is there a way to reduce the modularity issues - I'm thinking using toolchain to build per-port mappings from driver directories (maintaining current lists).
With respect to docs, I believe @bkueng new module shows what would need to be added for this module docs: https://github.com/PX4/Firmware/blob/master/src/templates/module/module.cpp
Anything else need to be done Beat?
@ChristophTobler As above, please confirm the documentation is accurate and confirm the FMU versions this starts "out of the box" for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the TFmini is only automatically started on Pixhawk FMUv3 (but not before or later) ... right?
correct. For other boards you need to manually disable mavlink on the port (rcS) and start the driver.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cheers, I have added you as reviewer for this update in PX4/PX4-user_guide#138
@@ -173,7 +174,7 @@ class TFMINI : public device::CDev | |||
extern "C" __EXPORT int tfmini_main(int argc, char *argv[]); | |||
|
|||
TFMINI::TFMINI(const char *port, uint8_t rotation) : | |||
CDev("TFMINI", RANGE_FINDER0_DEVICE_PATH), | |||
CDev(NAME, DEVICE_PATH), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's wrong with defaulting to
RANGE_FINDER0_DEVICE_PATH
and letting the command line override?
I guess you're talking about this?
Can we have several range finders this way?
Looking good, but why drop the default port? Other boards (like aero) can specify something else. |
@dagar I dropped it because it creates more confusion/damage, I think. |
this is more consistant and should enable it on qurt/linux
584902b
to
970ef66
Compare
Could you check Circle / rebase? Thanks! |
@LorenzMeier done |
@@ -396,7 +396,11 @@ fi | |||
# Benewake TFMini | |||
if param greater SENS_EN_TFMINI 0 | |||
then | |||
tfmini start | |||
if ver hwcmp PX4FMU_V3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this specific to this board? Previously we enabled this on every board - since they have to set SENS_EN_TFMINI for this to be started, what difference does it make?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference is the device (-d /dev/ttyS6
). Previously, It could happen that it breaks other devices/sensors...
Hi, All, |
To follow up, I connected tfmini to the telem port of the pixhawk-mini, and enabled the tfmini through QGC, then I used the Tools/mavlink_shell.py to check the status and test: For your information, the same procedure worked on a regular pixhawk on serial4/5 port. Using the shell, I can see that tfmini was connected to /dev/ttyS6 and “tfmini test” shows it is working. |
@weiminshen99 Generally speaking not a good idea to piggy-back onto closed issues. The right places for discussing issues are here: https://docs.px4.io/en/#support According to the docs https://docs.px4.io/en/sensor/rangefinders.html#tfmini serial 4/5 is the correct port and you need to set SENS_EN_TFMINI > 0. On this board you should not need to install the mini in firmware or start tfmini yourself. |
Hi, Hamish,
Thanks for your reply and I appreciate your suggestions.
Please notice that there is no serial 4/5 on this Pixhawk_Mini board, and that was why I asked the question. On a regular Pixhawk (not mini) boards, I have been using TFMINI successfully based on the document you mentioned. Do you have any suggestions where I can find more information about this particular question? Thanks!
… On May 20, 2018, at 6:07 PM, Hamish Willee ***@***.***> wrote:
@weiminshen99 <https://github.com/weiminshen99> Generally speaking not a good idea to piggy-back onto closed issues. The right places for discussing issues are here: https://docs.px4.io/en/#support <https://docs.px4.io/en/#support>
According to the docs https://docs.px4.io/en/sensor/rangefinders.html#tfmini <https://docs.px4.io/en/sensor/rangefinders.html#tfmini> serial 4/5 is the correct port and you need to set SENS_EN_TFMINI > 0. On this board you should not need to install the mini in firmware or start tfmini yourself.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#8726 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AXqet39hNip9hLb1uEZ77-3Jqz2_Z3Evks5t0hNVgaJpZM4Ri6Og>.
|
@weiminshen99 OK, it may be that the docs are wrong. If you look at current master here it looks you must also set SYS_COMPANION 0 and then start tfmini on /dev/ttyS2 - TELEM2 usually. Let me know if that works. |
Thanks! I will test and let you know.
…Sent from my iPad
On May 20, 2018, at 10:53 PM, Hamish Willee ***@***.***> wrote:
@weiminshen99 OK, it may be that the docs are wrong. If you look at current master here it looks you must also set SYS_COMPANION 0 and then start tfmini on /dev/ttyS2 - TELEM2 usually.
Let me know if that works.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
This fixes the tfmini for other boards than Pixhawk v2.
The main issue was the default device path https://github.com/PX4/Firmware/blob/master/src/drivers/distance_sensor/tfmini/tfmini.cpp#L84
The driver was started without any specific device path which resulted in problems for other boards -> e.g. disables other sensors.
Stopping the driver and restarting it on the correct device path didn't work... not sure why. By requiring the device path we can solve the issue.