2788west / cerusbot Goto Github PK
View Code? Open in Web Editor NEWHome Page: http://www.johanschwind.xyz
License: The Unlicense
Home Page: http://www.johanschwind.xyz
License: The Unlicense
Hi,
I fail to set up a subscriber on my Arduino that listens to Twist commands from /cmd_vel.
Other messages and topics work.
I took your arduino code and boiled it down to a minimum. Every time my arduino gets a Twist command, the LED should blink.
But nothing happens.
Du you have any idea, what Im doing wrong? I use ubuntu 20 and ROS noetic on my laptop.
Here is my code:
#include <ros.h>
#include <geometry_msgs/Twist.h>
//Configure ROS
ros::NodeHandle nh;
geometry_msgs::Twist msg;
//Create a message callback that updates the motor speeds
void messageCb(const geometry_msgs::Twist& cmd_vel)
{
digitalWrite(5, HIGH-digitalRead(5));
}
//Subscribe to the Twist message
ros::Subscriber <geometry_msgs::Twist> sub("/cmd_vel", &messageCb);
//Setup the node and subscriber once
void setup()
{
nh.initNode();
nh.subscribe(sub);
pinMode(5, OUTPUT);
digitalWrite(5, HIGH);
Serial.begin(9600); // needs to be at end of setup loop
}
//Loop forever
void loop()
{
while (!nh.connected())
{
nh.spinOnce();
}
nh.spinOnce();
delay(1);
}
Im really glad for any hint!
Regards!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.