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

Examples required - User friendly improvement #191

Open
LightningPORTO opened this issue Jan 28, 2022 · 13 comments
Open

Examples required - User friendly improvement #191

LightningPORTO opened this issue Jan 28, 2022 · 13 comments

Comments

@LightningPORTO
Copy link

Hello,

For context, I'm attempting to develop a UAVcan implementation using cannard, on a STM32 using RTOS.

I find the examples on the readme satisfactory and I believe we could benefit from full a example of publishing and subscribing to messages and services.
I don't mean specifically for my case (would also be nice), but a very generic (maybe heartbeat publish and subscribe?) implementation, fully written on a C example.

Could this be arranged? If there is anything I haven't found using the current version found on this repo.

Thank you for this amazing protocol and amazing work.

@LightningPORTO LightningPORTO changed the title Examples required Examples required - User friendly improvement Jan 28, 2022
@pavel-kirienko
Copy link
Member

pavel-kirienko commented Jan 28, 2022

Thanks for the kind words.

We have full-featured demos here, but they are for an earlier revision of this library where the API is slightly different: https://github.com/UAVCAN/demos

The full API diff can be seen here (scroll to canard.h and ignore the rest):

cf0a8bc#diff-6d1addc3815ef077e06339f13578aa999d57eba65be6a707e2fe55d4e0038509

A pull request to the demos repo updating the API from v1 to v2 would be much appreciated.

@LightningPORTO
Copy link
Author

Thank you for such a quick answer Pavel,

I was hoping I could get a barebones example of a publish and subscribe to a heartbeat message for example.
The given examples are great but very complex ( at least to me ) to understand the steps required to implement such basic functions.

When I mean "barebones" I'm actually trying to get little increments at a time, the protocol is great but with a very steep learning curve. For example, ROS has tutorials for publishing and subscribing...

I'm not saying to get a full wiki and all going on, but maybe a little beginner-friendly approach wouldn't hurt.

Maybe a simple (and possibly separate examples) to publish and subscribe to the heartbeat messages would be a good start?

Once again, there are just suggestions, but coming from someone who has average knowledge in programing and really sees the potential of this protocol.

@silverv
Copy link

silverv commented Jan 31, 2022

While not a bare bones example, this Sapog repository is closer to what you need than the demo repository:

  • it runs on actual hardware instead of just as a process on a computer
  • uses libcanard v2
  • is supposed to become a reference project for new adopters
  • quite extensive

See that first. I haven't planned on when I will be making bare bones examples yet.
https://github.com/Zubax/sapog/tree/v3/firmware/src/node

@LightningPORTO
Copy link
Author

This is somewhat closer to what I was looking for. Im attempting to implement libcannard to talk to a PX4 autopilot, using a Nucleo board STM. I know there are examples out there, but none are using the latest libcannard...

Thank you for your sugestion, if in the future you do a barebones, please let me know.

@coderkalyan
Copy link
Contributor

I think I have an example using Zephyr RTOS somewhere, but its also using the canard V1 API. If I find some time I'll update it and share.

@ValeriiKim
Copy link

ValeriiKim commented Apr 9, 2022

This is somewhat closer to what I was looking for. Im attempting to implement libcannard to talk to a PX4 autopilot, using a Nucleo board STM. I know there are examples out there, but none are using the latest libcannard...

Thank you for your sugestion, if in the future you do a barebones, please let me know.

If you are interested here is my repo where libcanard v2 is used: https://github.com/ValeriiKim/Modrob-UAVCAN/tree/master/src/TEST_MODULE

@pavel-kirienko
Copy link
Member

The demos have been updated to use the new libcanard v3: OpenCyphal-Garage/demos#12

@Dmivaka
Copy link

Dmivaka commented Sep 6, 2022

This is somewhat closer to what I was looking for. Im attempting to implement libcannard to talk to a PX4 autopilot, using a Nucleo board STM. I know there are examples out there, but none are using the latest libcannard...

Thank you for your sugestion, if in the future you do a barebones, please let me know.

I don't know if it's fair to call the use of STM32Cube "barebone", but here is a simple Libcanard 2 example for it, with project generation from .ioc - https://github.com/Dmivaka/STM32-HAL-Libcanard

@githubfa
Copy link

one simple demo is better than 1000 words😂. i am a beginner of uavcan, and it's difficult for me to find out such as: how the demo work, what is the relation ship between libcanard and DSDL? how can i use libcanard with DSDL? it's all question ...

@pavel-kirienko
Copy link
Member

The demos I linked earlier illustrate both. Take a look at this one: https://github.com/OpenCyphal-Garage/demos/tree/main/differential_pressure_sensor

It is a very basic application that incorporates both libcanard and DSDL code generation (via Nunavut). You can easily port it to an embedded platform (it can be run on GNU/Linux out of the box).

You can also check out @aentinger's Arduino Cyphal and its examples -- it might be more approachable.

@githubfa
Copy link

The demos I linked earlier illustrate both. Take a look at this one: https://github.com/OpenCyphal-Garage/demos/tree/main/differential_pressure_sensor

It is a very basic application that incorporates both libcanard and DSDL code generation (via Nunavut). You can easily port it to an embedded platform (it can be run on GNU/Linux out of the box).

You can also check out @aentinger's Arduino Cyphal and its examples -- it might be more approachable.

Thanks a lot! maybe those demo can be join into the README.md to give other more help, even if it's just a link.

@mehrkonfetti
Copy link

Would you still be interested in adding more minimal samples (like a heartbeat subscriber & publiser) to eg the demos repository? I have found myself looking for something like this a couple of times now and would love to implement it.

@pavel-kirienko
Copy link
Member

Would you still be interested in adding more minimal samples (like a heartbeat subscriber & publiser) to eg the demos repository?

Yes.

I have found myself looking for something like this a couple of times now and would love to implement it.

Please do. As an alternative to the demos repo, you can also publish a link to your example here: https://forum.opencyphal.org/t/libcanard-examples-starters-tutorials/935

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

No branches or pull requests

8 participants