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

Add support for MavlinkShell on Linux platform #14399

Closed

Conversation

SalimTerryLi
Copy link
Contributor

@SalimTerryLi SalimTerryLi commented Mar 16, 2020

Describe problem solved by this pull request
This PR enables MavlinkShell on Linux based boards like RPi.

Describe your solution
A new thread is launched to capture and duplicate stdin.
Add extra codes in px4_log.cpp to duplicate stdout.

QGC doesn't deal with control characters so each _print_prompt() would mess up the latest line in QGC.

Describe possible alternatives
Better implement can only be achieved if the whole pxh is designed in another way which is similar to pty.(maybe)

Test data / coverage
Works on RPi. Screenshots here.
pr-mavshell

@TSC21 TSC21 requested review from julianoes and dagar March 16, 2020 08:04
@SalimTerryLi SalimTerryLi changed the title Add support for MavlinkShell on Linux platform [WIP]Add support for MavlinkShell on Linux platform Mar 16, 2020
@hamishwillee
Copy link
Contributor

Nice. When this goes in we should update https://dev.px4.io/master/en/debug/mavlink_shell.html and possibly https://docs.qgroundcontrol.com/en/analyze_view/mavlink_console.html (assuming that is the access method?)

@SalimTerryLi
Copy link
Contributor Author

This PR failed to work with sitl, but I don't know why. Maybe I would simply drop the support for sitl with macros.

@hamishwillee
Copy link
Contributor

Well it isn't so critical on SITL because you can drive the system from the terminal in which you started it.

@SalimTerryLi SalimTerryLi force-pushed the pr-mavlinkshell_support_on_linux-add branch 3 times, most recently from e9cc409 to db7b878 Compare March 17, 2020 07:53
@SalimTerryLi
Copy link
Contributor Author

SalimTerryLi commented Mar 17, 2020

This implement seems is not elegant at all. Needs some tests on other Linux boards to verify its effectiveness.(#14404) It's really confusing that SITL would crash with segment fault. I don't know whether this PR worth to be merged or not.

@bkueng bkueng self-requested a review March 17, 2020 08:57
@SalimTerryLi SalimTerryLi changed the title [WIP]Add support for MavlinkShell on Linux platform Add support for MavlinkShell on Linux platform Mar 17, 2020
@SalimTerryLi SalimTerryLi force-pushed the pr-mavlinkshell_support_on_linux-add branch from db7b878 to ddbae5c Compare March 17, 2020 17:47
@@ -1,5 +1,7 @@
add_definitions(
-D__PX4_LINUX

-D__PX4_LINUX_CONSOLE
Copy link
Member

Choose a reason for hiding this comment

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

If there somewhere we wouldn't want this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR won't work with SITL at all. I don't know why. Since SITL shares __PX4_LINUX as well, I tried to introduce __PX4_LINUX_CONSOLE. Also this PR won't work with QURT because I use poll logic.

@dagar
Copy link
Member

dagar commented Mar 18, 2020

Note for later, you might be interested in extending PX4 dmesg (#11792) for Linux as well.

@SalimTerryLi
Copy link
Contributor Author

Note for later, you might be interested in extending PX4 dmesg (#11792) for Linux as well.

It seems the function of Nuttx dmesg is already here because I use a pair of pipes for buffering. This PR is not very elegant because the way it goes is greatly different from Nuttx's.

@dayjaby
Copy link
Contributor

dayjaby commented Mar 24, 2020

Well it isn't so critical on SITL because you can drive the system from the terminal in which you started it.

Not critical, but still very nice to have. I got plenty gazebo simulations running as systemd services, so getting a serial console is quite frustrating there (kill the px4 process, restart it manually)

@SalimTerryLi
Copy link
Contributor Author

Well it isn't so critical on SITL because you can drive the system from the terminal in which you started it.

Not critical, but still very nice to have. I got plenty gazebo simulations running as systemd services, so getting a serial console is quite frustrating there (kill the px4 process, restart it manually)

It sounds a little difficult but I'll try it...

@julianoes julianoes removed their request for review March 25, 2020 13:04
@dayjaby
Copy link
Contributor

dayjaby commented Apr 28, 2020

It sounds a little difficult but I'll try it...

@SalimTerryLi how is the progress here?

@SalimTerryLi
Copy link
Contributor Author

It sounds a little difficult but I'll try it...

@SalimTerryLi how is the progress here?

Sorry but I moved to other tasks those days, may not be able to focus on that in a few weeks. It really requires a lot of investigation for me but I'm not urgently need that function...

@julianoes
Copy link
Contributor

julianoes commented Jun 26, 2020

This would still be helpful. I'm going to try it out now. Nevermind, not now.

@stale
Copy link

stale bot commented Oct 4, 2020

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the stale label Oct 4, 2020
@julianoes
Copy link
Contributor

This is somewhat replaced by #19800, right?

@stale stale bot removed the stale label Jul 25, 2022
@SalimTerryLi
Copy link
Contributor Author

This is somewhat replaced by #19800, right?

That is. I'm closing this now :)

@SalimTerryLi SalimTerryLi deleted the pr-mavlinkshell_support_on_linux-add branch April 24, 2023 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants