nao_driver and joint_states with NaoQI 1.12
Hi,
I am using NaoQi 1.12 and the stable ROS Electric version. It is all running fine, except the joint_states which are published by the nao_driver node. I am able to publish new joint values which result in an modified pose for nao, but if I subscribe to the joint_states topic it return only zero for all joint positions. Here a piece of my code:
void jointStateCallback(const sensor_msgs::JointState::ConstPtr &jointState) {
std::vector<std::string> names;
std::vector<double> positions;
jointState->get_name_vec(names);
jointState->get_position_vec(positions);
for (unsigned int i = 0; i < positions.size(); i++)
std::cout << positions.at(i) << std::endl;
}
int main(int argc, char **argv) {
ros::init(argc, argv, "naomotion");
ros::NodeHandle nh
[...]
ros::Subscriber sub = nh.subscribe("joint_states", 5, jointStateCallback);
while (nh.ok()) {
[...]
ros::spinOnce();
rate.sleep();
}
}
Thanks so far, for any suggestions and help.
Chris
I am quite new at this an I am looking for examples of how to create ROS modules for controlling NAO. Could you please provide me with your CMekeLists.txt file, manifest.xml file and what header files did you use in your example? Any help would have been greatly appreciate it. Best Regards, Akis
Akis, there is since a while official support for Nao in ROS. Check http://wiki.ros.org/nao/ and https://github.com/ahornung/nao_robot for the source code.
severin, thank you for your reply. I have already gone through the ROS wiki for NAO and I have completed the tutorials in http://wiki.ros.org/nao/Tutorials/Getting-Started. I am trying now to make this top node that Chris demonstrates with his code and subscribes to NAO Driver, but because I am not familiar with the NAO stack, the example does not compile... Therefore, I would like to know what headers should I include in my .cpp code as well as what should I include in CMekeLists.txt and manifest.xml files. Any extra help would be appriciate it... Akis
Problem solved... Nothing to worry about... Cheers Akis :)
Hi again, I am trying to install the latest NAO stack as instructed in http://wiki.ros.org/nao/Installation/remote. Unfortunately, I am using ROS Fuerte, which does not have catkin installed an I cannot operate under catkin workspace. As far as I understood, the result is to be unable to properly install the NAO stack under rosbuild. Is there anyway to overcome this problem or do I have to move to a later ROS version (e.g. Groovy)? Thank you for your help in advance. Bast, Akis
Use the installation instructions for version 0.1, version 0.2 is for Groovy and Hydro. To use the newer version you will have to upgrade.
@Akis: By the way, best ask a new question for new problems. Don't use the comments on completely unrelated questions for that.
I understand and that is what I tried to do initially, but for some reason I was not allow to ask a question due to insufficient karma (as it said..). In any case could you please let me know from where can I download the 0.1 version? ( I used the installation instructions for 0.1 rosbuild but still it indicates "ERROR: the following packages/stacks could not have their rosdep keys resolved to system dependencies: nao_teleop: Missing resource catkin") Thank you.