Ask Your Question
1

nao_driver and joint_states with NaoQI 1.12

asked 2012-03-06 01:22:59 -0500

SLAMnect gravatar image

updated 2012-03-16 06:18:15 -0500

AHornung gravatar image

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

edit retag flag offensive close merge delete

Comments

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 gravatar imageAkis ( 2013-11-13 00:54:15 -0500 )edit

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 gravatar imageseverin ( 2013-11-13 07:46:56 -0500 )edit

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

Akis gravatar imageAkis ( 2013-11-13 22:00:12 -0500 )edit

Problem solved... Nothing to worry about... Cheers Akis :)

Akis gravatar imageAkis ( 2013-11-14 22:59:19 -0500 )edit

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

Akis gravatar imageAkis ( 2013-11-20 04:14:40 -0500 )edit

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.

AHornung gravatar imageAHornung ( 2013-11-20 04:17:22 -0500 )edit

@Akis: By the way, best ask a new question for new problems. Don't use the comments on completely unrelated questions for that.

AHornung gravatar imageAHornung ( 2013-11-20 04:18:35 -0500 )edit

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.

Akis gravatar imageAkis ( 2013-11-20 04:24:37 -0500 )edit

3 Answers

Sort by » oldest newest most voted
0

answered 2012-03-16 06:17:04 -0500

AHornung gravatar image

I was able to reproduce this with a local, simulated NaoQI 1.12. I assume it's a bug in NaoQI 1.12 and will happen in the same way if you directly use the API. motionProxy.getAngles('Body', useSensors) will return zeros when not running directly on the robot and useSensors=True, while this used to work in NaoQI < 1.12.

I created a new parameter "~use_joint_sensors" in nao_sensors.py as workaround and reported the problem to Aldebaran. Until it's fixed, I suggest updating to the latest version of nao_driver (in SVN) and setting the parameter to False, or directly changing that line in your code.

edit flag offensive delete link more
0

answered 2012-03-06 21:34:36 -0500

SLAMnect gravatar image

What do you mean with "publish new joint state values"? The joint_states array should just represent Nao's current state from the sensors

nao_controller and nao_driver are running both. The problem is that rostopic echo joint_states gives me an output were all joint positions are 0.0 all the time. If I move one joint, rviz shows the angles correct, but the topic joint_states claims 0.0. And this point confuses me.

My idea is to switch directly to the NaoQi API and get the sensor information directly. Thx for the help.

edit flag offensive delete link more
0

answered 2012-03-06 06:25:57 -0500

AHornung gravatar image

What do you mean with "publish new joint state values"? The joint_states array should just represent Nao's current state from the sensors. Use nao_controller (e.g. with the topic joint_angles or the action goals) to execute joint trajectories. If nao_sensors in nao_driver is running and you execute rostopic echo joint_states and rostopic hz joint_states, what do you see? If you afterwards start the launch file in nao_description, does the robot look "correct" in RViz? Looking out for errors in rxconsole is also a good starting point.

Sometimes NaoQI or its python API hang and I've seen zeroes in the IMU, but never in the joint state. This problem usually went away after restarting NaoQI on the robot or completely rebooting it.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-03-06 01:22:59 -0500

Seen: 770 times

Last updated: Mar 16 '12