Coder Social home page Coder Social logo

2788west / cerusbot Goto Github PK

View Code? Open in Web Editor NEW
12.0 12.0 7.0 6.35 MB

Home Page: http://www.johanschwind.xyz

License: The Unlicense

C++ 12.08% Jupyter Notebook 78.31% CMake 9.62%
arduino encoders jetson-nano robot teleop wheels xbox-controller

cerusbot's Issues

Issue with Twist msg and rosserial

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.