Use a Joystick in qnode.cpp
Hi there,
i am quite new to ROS and c++, so excuse if if this question is an easy one, plz :)
i created a package with catkin_create_qt_package and now i want to use a JoyListener.
The problem is, that i really don't know how to integrate the code? I found some examples for using the joy.h node, but nothing for using it in the catkin created qt package :( Do i have to add the code in qnode.cpp ?
Sorry for my english XD i don't know how to explain my problem :3
[Edit] Sorry, i don't get it :( I used this code for subscribing the joy-node:
ros::Subscriber sub = n.subscribe<sensor_msgs::Joy>("joy", 10, &QNode::joyCallback);
And this is my prototype of the joyCallback-function:
void QNode::joyCallback(const sensor_msgs::Joy::ConstPtr& joy_msg)
{
ros::Publisher chatter_publisher.publish(joy_msg);
}
but i get this strange error and don't know what it means...
/usr/include/boost/function/function_template.hpp:225: error: no match for call to ‘(boost::_mfi::mf1<void, test_joy::QNode, const boost::shared_ptr<const sensor_msgs::Joy_<std::allocator<void> > >&>) (const boost::shared_ptr<const sensor_msgs::Joy_<std::allocator<void> > >&)’
do you have any idea of what i'm doing wrong?
Do you want to receive joystick messages? In that case check out the standard subscriber tutorial.
i want to use the joystick for controlling an AR Drone. I thought it would be fine to display the pressed buttons in an QT gui, but i dont know how to check, which button is pressed from the gui package :/
If you want to know which buttons are pressed on a running joystick node then subscribe to a sensor_msgs/Joy message. It's usually on the /joy topic.
Ok thanks, i'll try it out :)
I don't get it >___< i updated the question to what i have done to subscribe the joy-messages.. help plz :(