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: IMU SPI_Encoder mbed Path PID Motor Inertia ros_lib_kinetic Kinematics Mycan
main.cpp
- Committer:
- Kirua
- Date:
- 2019-07-22
- Revision:
- 0:8b0869cb7fa8
- Child:
- 1:0839d3bc46c2
File content as of revision 0:8b0869cb7fa8:
#include "mbed.h" #include <ros.h> #include <std_msgs/Float32MultiArray.h> #include "set.h" #define inertia M*R*R //moment of inertia float voltage; float resistance; float kt; float ke; float *w; float torque; float pwm = 1 / voltage * ((resistance * (torque) / kt) + (*w * ke)); ros::NodeHandle nh; DigitalOut myled(LED1); float coordinate[3] = {}; void callback(const std_msgs::Float32MultiArray& msg) { int size = msg.data_length; for (int i = 0; i < size; i++) coordinate[i] = msg.data[i]; } ros::Subscriber<std_msgs::Float32MultiArray> sub("bath_towel", callback); int main() { nh.initNode(); nh.subscribe(sub); while(1) { nh.spinOnce(); wait_ms(1); } }