Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-STM32F103C8T6 mbed libuavcan
Revision 5:f59c880d75c6, committed 2018-05-12
- Comitter:
- RuslanUrya
- Date:
- Sat May 12 08:58:56 2018 +0000
- Parent:
- 4:05f811770392
- Commit message:
- ???????? ??? ????????? ? ??????????????
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu May 10 13:57:17 2018 +0000
+++ b/main.cpp Sat May 12 08:58:56 2018 +0000
@@ -1,11 +1,9 @@
#include "mbed.h"
-#//include <libuavcan/libuavcan/include.mk> //core
-//#include <libuavcan/libuavcan_drivers/stm32/driver/include.mk> //stm32 driver
-//#include <libuavcan/libuavcan/dsdl_compiler/setup.py> //run dsdl compiler?
#include "chip.h" //build configuration
#include "libuavcan/libuavcan/include/uavcan/build_config.hpp" //All default configuration options
#include "libuavcan/libuavcan_drivers/stm32/driver/include/uavcan_stm32/build_config.hpp" //OS detection; Any General-Purpose timer
#include "libuavcan/libuavcan/include/uavcan/node/publisher.hpp" //Publisher class
+#include "stm32f103c8t6.h"
#include <uavcan/equipment/actuator/Command.hpp> //message type
@@ -22,8 +20,10 @@
int main() {
+ confSysClock();
auto& node = getNode();
- node.setName("Actuator");
+ node.setNodeID(1);
+ node.setName("Publisher");
if (node.start() > 0){ //<>?
//обработка ошибок запуска
}
@@ -38,10 +38,10 @@
if (node.spin(uavcan::MonotonicDuration::fromMSec(1000)) < 1){
//обработка ошибок
}
- uavcan::equipment::actuator::Command msg; //что вместо uavcan::protocol::debug::KeyValue?
- msg.actuator_id = 1;
- msg.command_type = COMMAND_TYPE_UNITLESS //[-1, 1]
- msg.command_value = 1;
+ uavcan::equipment::actuator::Command msg;
+ msg.actuator_id = 2;
+ msg.command_type = COMMAND_TYPE_POSITION //meter or radian
+ msg.command_value = pi;
if (pub.broadcast(msg) > 0){ // отправка сообщения
// обработка ошибок