-
Notifications
You must be signed in to change notification settings - Fork 63
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
Functioning with custom device driver. #46
Comments
Hi, Currently, there is no conprehensive documentation on driver development. We will add it once the interfaces are stable. If you want to create a driver now, it can either inherit from ros2_canopen::BaseDriver or from ros2_canopen::ProxyDriver. You will also need to override on_nmt which is a callback tracking nmt_state of the slave and on_rpdo which is a callback for handling pdo messages sent by the slave. (Check in canopen_base_driver.hpp there is some documentation and check in canopen_proxy_driver.cpp for how to use it) |
Hallo Christoph, Thank you very much for your reply. |
Hi there, Appologies I am also a bit new when it comes to CanOpen and the ros2_canopen library. I'm trying to create my own device driver using the ProxyDriver (or BaseDrive, i don't really mind), and I understand how to implenent the class but am not sure where to actually init the driver. The doc string in
My question: Where is the 'masters event loop'? I currently just have a configuration package with some launch files? I feel like I might be missing something fundamental here. Appologies for the question, and thankyou in advance for your help! Regards |
Hey @ipa-cmh - Sorry to tag but wasn't sure if you would see the above question with the issue closed. Would really appreciate any direction. Regards, |
Hi Tom, We are currently reworking the strucutre for custom device drivers. What kind of device do you want to write a driver for? Best |
Hey Christoph, Thankyou for getting back to me :) I'm writing a driver for a custom device (are using an implementation of the CanOpen stack on a in-house designed stm32 based board). The device only needs to be able to send and recieve PDO's at a very basic level, so don't need much 'fancy' functionality. We've written a driver based on the proxy driver, and it looks good, but am just not sure where to add the deivce to the configuration or how to launch it. Using ROS2 Galactic for reference. Thank you again, |
Hi Tom, Sorry for the late answer. You would need to make it a component. Once that is done, you should be able to include it into the bus.yaml file. TO make it a component you need to add:
To the bottom of your drivers .cpp file. In your CMakeLists.txt you need to make your driver a shared lib and add something like this:
Also make sure you install the libraries you create. |
Hello Team and @ipa-cmh , For mock slave i am using simple.eds and slave.cpp file. (implementation of simple incremental counter) When I launch the master and mock slave, i am able to get the data on the CAN bus but i am not able to get the data via ros topics: /proxy_device/tpdo and /proxy_device/rpdo. Maybe I am missing something and I would be thankful for your help.
|
Regarding the tpdo topic, this is only subscribed to. If you publish messages to it, it will send them via tpdo. The rpdo topic is the one that should show something.
This will fail silently when the driver is not marked as activated. This might be the issue. |
Hallo @ipa-cmh , Thank you very much for taking the time to read my concern and replying. |
Hallo Team and @ipa-cmh, I am using the Galactic branch, and was using OnRpdoWrite function which might caused the above problem of "no data on ros topic /proxy_device/rpdo. When I removed the function, its working fine. Logs attached below. [device_container_node-2] [INFO] [1667566652.409385929] [proxy_device]: Slave 2: Sent PDO index 16385, subindex 0, data 1 can0 701 [1] 05 ros2 topic echo /proxy_device/rpdo
|
@8vin8 great thanks for the heads up! |
Hello Team,
I am a newbie to CANopen and ROS2, I have gone through this https://ros-industrial.github.io/ros2_canopen/ as well, but not able to understand how can I add a device driver and not able to understand how this new repository is functioning. Do you have some more documentation where I can understanding how its working.
I have also gone through this documentation and implementation of master slave part https://opensource.lely.com/canopen/docs/installation/
I need more information how to add a device driver into this CANopen stack.
I would be grateful for your help.
Regards
The text was updated successfully, but these errors were encountered: