Skip to content

Commit

Permalink
refactor pwm module, so now it is the same for cyphal and dronecan
Browse files Browse the repository at this point in the history
  • Loading branch information
PonomarevDA committed Sep 28, 2024
1 parent c9864ba commit 8fd217b
Show file tree
Hide file tree
Showing 21 changed files with 476 additions and 408 deletions.
2 changes: 1 addition & 1 deletion Src/applications/cyphal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ include(${SRC_DIR}/modules/cyphal/core/CMakeLists.txt)
include(${SRC_DIR}/modules/system/CMakeLists.txt)
include(${SRC_DIR}/modules/circuit_status/cyphal/CMakeLists.txt)
include(${SRC_DIR}/modules/cyphal/feedback/CMakeLists.txt)
include(${SRC_DIR}/modules/cyphal/setpoint/CMakeLists.txt)
include(${SRC_DIR}/modules/pwm/CMakeLists.txt)
19 changes: 19 additions & 0 deletions Src/applications/cyphal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,25 @@ The node has the following registers:
| 3 | system.name | Defines custom node name. If empty, the node will use the default name. |
| 4 | system.protocol | Auto, Cyphal/CAN or DroneCAN |
| 5 | uavcan.node.description | User/integrator-defined, human-readable description of this specific node. |
| 6 | system.log_level | Log level. See [debug.LogLevel](https://dronecan.github.io/Specification/7._List_of_standard_data_types/#loglevel) and [diagnostic.Severity](https://github.com/OpenCyphal/public_regulated_data_types/blob/master/uavcan/diagnostic/Severity.1.0.dsdl). </br> 0 - Log everything (DEBUG, INFO, WARNING, ERROR) </br> 1 - Log at least INFO level </br> 2 - Log at least WARNING level </br> 3 - Log at least ERROR level </br> 4 - Disable logging </br> By default 3 to show only realy important messages. |
| 7 | pwm.cmd_ttl_ms | TTL of specified by pwm.cmd_type commands [ms]. |
| 8 | pwm.frequency | PWM frequency [Hz]. |
| 9 | pwm1.ch | Index of setpoint channel. [-1; 255]. -1 means disabled, |
| 10 | pwm1.min | PWM duration when setpoint is min (RawCommand is 0 or Command is -1.0) |
| 11 | pwm1.max | PWM duration when setpoint is max (RawCommand is 8191 or Command is 1.0) |
| 12 | pwm1.def | PWM duration when setpoint is negative or there is no setpoint at all. |
| 13 | pwm2.ch | Index of setpoint channel. [-1; 255]. -1 means disabled, |
| 14 | pwm2.min | PWM duration when setpoint is min (RawCommand is 0 or Command is -1.0) |
| 15 | pwm2.max | PWM duration when setpoint is max (RawCommand is 8191 or Command is 1.0) |
| 16 | pwm2.def | PWM duration when setpoint is negative or there is no setpoint at all. |
| 17 | pwm3.ch | Index of setpoint channel. [-1; 255]. -1 means disabled, |
| 18 | pwm3.min | PWM duration when setpoint is min (RawCommand is 0 or Command is -1.0) |
| 19 | pwm3.max | PWM duration when setpoint is max (RawCommand is 8191 or Command is 1.0) |
| 20 | pwm3.def | PWM duration when setpoint is negative or there is no setpoint at all. |
| 21 | pwm4.ch | Index of setpoint channel. [-1; 255]. -1 means disabled, |
| 22 | pwm4.min | PWM duration when setpoint is min (RawCommand is 0 or Command is -1.0) |
| 23 | pwm4.max | PWM duration when setpoint is max (RawCommand is 8191 or Command is 1.0) |
| 24 | pwm4.def | PWM duration when setpoint is negative or there is no setpoint at all. |

> This docs was automatically generated. Do not edit it manually.
2 changes: 1 addition & 1 deletion Src/applications/dronecan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include(${SRC_DIR}/modules/system/CMakeLists.txt)
include(${SRC_DIR}/modules/dronecan/arming/CMakeLists.txt)
include(${SRC_DIR}/modules/circuit_status/dronecan/CMakeLists.txt)
include(${SRC_DIR}/modules/dronecan/feedback/CMakeLists.txt)
include(${SRC_DIR}/modules/dronecan/pwm/CMakeLists.txt)
include(${SRC_DIR}/modules/pwm/CMakeLists.txt)

if(USE_PLATFORM_NODE_V3)
include(${SRC_DIR}/modules/imu/CMakeLists.txt)
Expand Down
49 changes: 24 additions & 25 deletions Src/applications/dronecan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,29 @@ The node has the following registers:
| 3 | system.name | Defines custom node name. If empty, the node will use the default name. |
| 4 | system.protocol | Auto, Cyphal/CAN or DroneCAN |
| 5 | uavcan.node.description | User/integrator-defined, human-readable description of this specific node. |
| 6 | stats.engaged_time | Total engaged time of node in seconds. |
| 7 | pwm.cmd_ttl_ms | TTL of specified by pwm.cmd_type commands [ms]. |
| 8 | pwm.frequency | PWM frequency [Hz]. |
| 9 | pwm.cmd_type | 0 means RawCommand, 1 means ArrayCommand, 2 is reserved for hardpoint.Command. |
| 10 | pwm.1_ch | Index of setpoint channel. [-1; 255]. -1 means disabled, |
| 11 | pwm.1_min | PWM duration when setpoint is min (RawCommand is 0 or Command is -1.0) |
| 12 | pwm.1_max | PWM duration when setpoint is max (RawCommand is 8191 or Command is 1.0) |
| 13 | pwm.1_def | PWM duration when setpoint is negative or there is no setpoint at all. |
| 14 | pwm.1_feedback | Indicates the operational mode of the node. 0 means disabled. When set to 1, the command of corresponding Status type for cmd_type will be transmitted (esc.RawCommand - esc.Status, actuator.ArrayCommand - actuator.Status) with frequency 1 Hz. When set to 2 - 10 Hz. |
| 15 | pwm.2_ch | Index of setpoint channel. [-1; 255]. -1 means disabled, |
| 16 | pwm.2_min | PWM duration when setpoint is min (RawCommand is 0 or Command is -1.0) |
| 17 | pwm.2_max | PWM duration when setpoint is max (RawCommand is 8191 or Command is 1.0) |
| 18 | pwm.2_def | PWM duration when setpoint is negative or there is no setpoint at all. |
| 19 | pwm.2_feedback | Indicates the operational mode of the node. 0 means disabled. When set to 1, the command of corresponding Status type for cmd_type will be transmitted (esc.RawCommand - esc.Status, actuator.ArrayCommand - actuator.Status) with frequency 1 Hz. When set to 2 - 10 Hz. |
| 20 | pwm.3_ch | Index of setpoint channel. [-1; 255]. -1 means disabled, |
| 21 | pwm.3_min | PWM duration when setpoint is min (RawCommand is 0 or Command is -1.0) |
| 22 | pwm.3_max | PWM duration when setpoint is max (RawCommand is 8191 or Command is 1.0) |
| 23 | pwm.3_def | PWM duration when setpoint is negative or there is no setpoint at all. |
| 24 | pwm.3_feedback | Indicates the operational mode of the node. 0 means disabled. When set to 1, the command of corresponding Status type for cmd_type will be transmitted (esc.RawCommand - esc.Status, actuator.ArrayCommand - actuator.Status) with frequency 1 Hz. When set to 2 - 10 Hz. |
| 25 | pwm.4_ch | Index of setpoint channel. [-1; 255]. -1 means disabled, |
| 26 | pwm.4_min | PWM duration when setpoint is min (RawCommand is 0 or Command is -1.0) |
| 27 | pwm.4_max | PWM duration when setpoint is max (RawCommand is 8191 or Command is 1.0) |
| 28 | pwm.4_def | PWM duration when setpoint is negative or there is no setpoint at all. |
| 29 | pwm.4_feedback | Indicates the operational mode of the node. 0 means disabled. When set to 1, the command of corresponding Status type for cmd_type will be transmitted (esc.RawCommand - esc.Status, actuator.ArrayCommand - actuator.Status) with frequency 1 Hz. When set to 2 - 10 Hz. |
| 30 | imu.enable | Enable or disable IMU publisher. |
| 6 | system.log_level | Log level. See [debug.LogLevel](https://dronecan.github.io/Specification/7._List_of_standard_data_types/#loglevel) and [diagnostic.Severity](https://github.com/OpenCyphal/public_regulated_data_types/blob/master/uavcan/diagnostic/Severity.1.0.dsdl). </br> 0 - Log everything (DEBUG, INFO, WARNING, ERROR) </br> 1 - Log at least INFO level </br> 2 - Log at least WARNING level </br> 3 - Log at least ERROR level </br> 4 - Disable logging </br> By default 3 to show only realy important messages. |
| 7 | stats.engaged_time | Total engaged time of node in seconds. |
| 8 | crct.bitmask | Bit mask to enable CircuitStatus features: </br> Bit 1 - enable dev.Temperature with device_id=NODE_ID, </br> Bit 2 - enable 5v publisher, </br> Bit 3 - enable Vin publisher. </br> Bit 4 - enable overvoltage, undervoltage, overcurrent and overheat checks. </br> By default 15 that mean enable all publishers |
| 9 | feedback.type | Indicates the operational mode of the node. 0 means disabled. When set to 1, the command of corresponding Status type for cmd_type will be transmitted (esc.RawCommand - esc.Status, actuator.ArrayCommand - actuator.Status) with frequency 1 Hz. When set to 2 - 10 Hz. |
| 10 | pwm.cmd_ttl_ms | TTL of specified by pwm.cmd_type commands [ms]. |
| 11 | pwm.frequency | PWM frequency [Hz]. |
| 12 | pwm1.ch | Index of setpoint channel. [-1; 255]. -1 means disabled, |
| 13 | pwm1.min | PWM duration when setpoint is min (RawCommand is 0 or Command is -1.0) |
| 14 | pwm1.max | PWM duration when setpoint is max (RawCommand is 8191 or Command is 1.0) |
| 15 | pwm1.def | PWM duration when setpoint is negative or there is no setpoint at all. |
| 16 | pwm2.ch | Index of setpoint channel. [-1; 255]. -1 means disabled, |
| 17 | pwm2.min | PWM duration when setpoint is min (RawCommand is 0 or Command is -1.0) |
| 18 | pwm2.max | PWM duration when setpoint is max (RawCommand is 8191 or Command is 1.0) |
| 19 | pwm2.def | PWM duration when setpoint is negative or there is no setpoint at all. |
| 20 | pwm3.ch | Index of setpoint channel. [-1; 255]. -1 means disabled, |
| 21 | pwm3.min | PWM duration when setpoint is min (RawCommand is 0 or Command is -1.0) |
| 22 | pwm3.max | PWM duration when setpoint is max (RawCommand is 8191 or Command is 1.0) |
| 23 | pwm3.def | PWM duration when setpoint is negative or there is no setpoint at all. |
| 24 | pwm4.ch | Index of setpoint channel. [-1; 255]. -1 means disabled, |
| 25 | pwm4.min | PWM duration when setpoint is min (RawCommand is 0 or Command is -1.0) |
| 26 | pwm4.max | PWM duration when setpoint is max (RawCommand is 8191 or Command is 1.0) |
| 27 | pwm4.def | PWM duration when setpoint is negative or there is no setpoint at all. |
| 28 | pwm.cmd_type | 0 means RawCommand, 1 means ArrayCommand, 2 is reserved for hardpoint.Command. |

> This docs was automatically generated. Do not edit it manually.
10 changes: 0 additions & 10 deletions Src/modules/cyphal/setpoint/CMakeLists.txt

This file was deleted.

9 changes: 0 additions & 9 deletions Src/modules/cyphal/setpoint/params.yaml

This file was deleted.

52 changes: 0 additions & 52 deletions Src/modules/cyphal/setpoint/setpoint.cpp

This file was deleted.

42 changes: 0 additions & 42 deletions Src/modules/cyphal/setpoint/setpoint.hpp

This file was deleted.

3 changes: 2 additions & 1 deletion Src/modules/dronecan/feedback/feedback.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
#include "publisher.hpp"
#include "subscriber.hpp"

#include "modules/dronecan/pwm/PWMModule.hpp"
#include "modules/pwm/main.hpp"
#include "modules/pwm/dronecan_frontend/dronecan_frontend.hpp"

enum class FeedbackType: uint8_t {
DISABLED,
Expand Down
10 changes: 0 additions & 10 deletions Src/modules/dronecan/pwm/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit 8fd217b

Please sign in to comment.