I am using ROS Kinetic on Ubuntu 16.04. I've been trying to get a custom message type to work over rosserial_arduino for some time now. I have properly generated the C++ message headers in the package. For reference, here is the custom message type I am planning on using:
# MotorEncoder.msg
int32 leftValue
int32 rightValue
time leftTime
time rightTime
After running `catkin_make` on the project workspace, I run the `source devel/setup.bash` command to let ROS know I have messages that need to have generated Arduino-based headers. Then I run the command
rosrun rosserial_client make_libraries ~/Arduino/libraries
This generates the Arduino-based headers which I am able to properly compile and run using this Arduino script:
#include
#include
ros::NodeHandle nh;
rover_core::MotorEncoder msg;
ros::Publisher pub("/test", &msg);
void setup() {
// put your setup code here, to run once:
nh.initNode();
nh.advertise(pub);
}
void loop() {
// put your main code here, to run repeatedly:
nh.spinOnce();
}
I ran the rosserial node after deploying it to the arduino:
rosrun rosserial_python serial_node.py /dev/ttyUSB0
And I get the output:
[INFO] [1531232541.250369]: ROS Serial Python Node
[INFO] [1531232541.262715]: Connecting to /dev/ttyUSB0 at 57600 baud
[ERROR] [1531232543.413050]: Creation of publisher failed: too many values to unpack
I've tried a bunch of different solutions, but nothing seems to be fixing the problem. I've tried differently structured message types as well. Is something wrong with the process I'm using to generate these? Any help would be greatly appreciated. I'd be more than happy to provide an additional information as well.
↧