using ros::shutdown() in arduino code
Hey there guys,
I am trying to write an arduino based code for my robot, that would allow me to use a button on the PS3 joystick as an emergency kill-switch. I thought using ros::shutdown() would work, but apparently the arduino ros library doesn't recognize it as a function. Here is the code.
#include <ArduinoHardware.h>
#include <ros.h>
#include <geometry_msgs/Twist.h>
#include <sensor_msgs/Joy.h>
ros::NodeHandle nh;
geometry_msgs::Twist msg;
void joyCall(const sensor_msgs::Joy& joy){
if (joy.buttons[14]==1)
ros::shutdown();
}
ros::Subscriber<sensor_msgs::Joy> sub("bluetooth_teleop/joy", &joyCall);
ros::Publisher pub("/cmd_vel", &msg);
void setup()
{
nh.initNode();
nh.advertise(pub);
nh.subscribe(sub);
}
void loop(){
msg.linear.x=0.1;
pub.publish(&msg);
nh.spinOnce();
}
Basically, I am publishing a constant velocity to the velocity node, but i want to kill the publisher as soon as a button on the joystick is pressed. However, I get this compiler error:
sketch_jun24a.ino: In function ‘void joyCall(const sensor_msgs::Joy&)’:
sketch_jun24a.ino:13:3: error: ‘shutdown’ is not a member of ‘ros’
Any help would be extremely useful. Thanks!