ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

rosserial arduino faulty data [closed]

asked 2016-10-11 11:37:38 -0500

DKS gravatar image

updated 2016-10-12 08:14:10 -0500

I'm running the following code un my Arduino Uno:

#include <ros.h>
#include <geometry_msgs/Twist.h>

ros::NodeHandle  nh;


void messageCb( const geometry_msgs::Twist& velo_msg){
  nh.loginfo(String(velo_msg.linear.x).c_str());
}

ros::Subscriber<geometry_msgs::Twist> sub("cmd_vel", &messageCb );

void setup() {
  nh.initNode();
  nh.subscribe(sub);
}

void loop() {
  nh.spinOnce();
}

If I publish the following message:

linear: 
  x: 0.5
  y: 0.0
  z: 0.0
angular: 
  x: 0.0
  y: 0.0
  z: 0.0
---

The output is correct:

[INFO] [WallTime: 1476202779.883673] 0.50

However if I publish this message:

linear: 
  x: -0.5
  y: 0.0
  z: 0.0
angular: 
  x: 0.0
  y: 0.0
  z: 0.0
---

The program seems to get faulty data from rosserial:

[INFO] [WallTime: 1476202781.667369] -0.00

Any idea what could be the issue? Am I making a type conversion mistake?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-10-12 08:13:56 -0500

DKS gravatar image

I fixed the issue with a fresh install of Kinetic.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-10-11 11:37:38 -0500

Seen: 155 times

Last updated: Oct 12 '16