How to make my Nao move?

Hi evrybody,I’m working with ROS2, i have the rolling distribution running in both in my PC and my Nao(both have the Ubuntu 22.04 OS installed).In my PC I spawned a simulated robot in my SimSpark simulation via command “ros2 run rcss3d_nao rcss3d_nao”, then I changed his position(beaming) with the command “ros2 topic pub --once effectors/beam rcss3d_agent_msgs/msg/Beam <some_coords>”.
Finally i made it rotate some parts with the command "ros2 topic pub --once effectors/joint_positions nao_command_msgs/msg/JointPositions ‘{indexes:{}, positions:{<degree_radian>}}’ noticeing that if I change the index number it will try to rotate a different part of the body, and changing the degree_radian part will change how much it will rotate.
Now I would like to do the same thing (making rotate parts and move) with my real Nao, but i don’t know how.I can connect with him by ssh and i can turn it off with the command “sudo shutdown -h now”.
Which package do I need to install in my Nao to make it move?Does he need the rcss3d_nao to subcribe to the topic that I send with my terminal?

1 Like

Good evening,I’m here to give you some more details about the situation. It looks like even if I public a topic via the command “ros2 topic pub <topic_name> <msg_type> ‘’” and then i run ros lola on my Nao, the connection between the topic and subscriber is estabilished(as is shown in the rqt_graph of my pc), but still the robot won’t move.Below I’ll attach you some screenshot about the command I tryed to execute (starting from the third command since I can’t run the soccersim3d on my Nao) and the general situation of my rqt_graph.


1 Like

Hi @Marco9700, welcome to RoboCup Cross-Cutting!

Great to hear that you got Ubuntu 22.04 / ROS 2 Rolling working on the NAO. I haven’t had a physical NAO to try it, so I am glad to hear that someone has it up and running fine.

As it seems like you have figured out, you need the nao lola running on the robot. When you’re working with the real robot, you don’t need rcss3d nao. Rcss3d nao is purely to talk to SimSpark simulation.

So,

  1. On your robot, run: ros2 run nao_lola nao_lola
  2. On your robot (or on your computer), run the same command you were using to move the robot in simulation: ros2 topic pub --once effectors/joint_positions nao_command_msgs/msg/JointPositions ‘{indexes:{}, positions:{}}’

You’d expect to see the robot move its joints like it did in simulation. That would be the most basic test to see if you can move the robot.

Once that is moving, you could try following the steps you posted. I recommend try and running the different pos files in the package to see if they all work as expected.

Please tell me how that goes.


I just want to make sure, you have access to the RoboCup-opn file, and you generated the Ubuntu 22.04 image using that? I ask because Nao LoLA is a way to talk to the LoLA interface on the NAO, and consumers (non-researchers) don’t have access to LoLA.


I’m also interested in hearing which team are you from! :slight_smile:

Kenji

1 Like

Hi kenji, thank you for answering my question.
Yes, I used the robocup-opn file to generate the Ubuntu image, precisely the “nao-2.8.5.11_ROBOCUP_ONLY_with_root.opn” one. I’m currently working with @bnontn89 and we are trying to create a new team at Unical university, in Italy. He told me that you two were in contact some months ago and talked about all the procedures to setting up the Nao.

2 Likes

Hi again Kenji , I followed the steps 1 and 2 you suggested me in the previous reply,noticing that even if the topic is successfully published,the robot still wont move its head.I also realized that the nao_interfaces package that I have in my Nao won’t compile with the command “colcon build --packages-select nao_interfaces” but it shouldn’t be a problem since, as you said, I can just publish the topic from my PC instead. I attach some screenshots to make you understand better what’s going on!



1 Like

colcon build --packages-select nao_interfaces

This will be because the name of the repository is nao_interfaces, but the packages inside it are nao_command_msgs and nao_sensor_msgs. To use packages-select, you will need to run colcon build --packages-select nao_command_msgs nao_sensor_msgs (or just colcon build to build all packages in your workspace).

From your screenshots, I wonder if something isn’t working correctly in Nao LoLA. Could you try enabling the debug logs for the NaoLola node by running nao_lola with some additional arguments:

ros2 run nao_lola nao_lola --ros-args --log-level NaoLola:=DEBUG


Another likely possibility is that the stiffness of all joints are zero, so the robot doesn’t have the torque to move the motors. You can check the joint stiffness by echoing the sensors/joint_stiffnesses topic.
If this is the case, send a JointStiffness message on effectors/joint_stiffnesses with the stiffness of the joint you are trying to move set to something else but zero. After that, you can send the Joint Position for the same joint, and you should expect the robot to move.

Thanks again for answering.I rebuilded the entire workspace with colcon build and it worked just fine.I enabled the debug mode in the ros2 run nao_lola command and it seems work fine(i attach the output below as always).

As you said echoing the sensors/joint_stiffnesses topic i saw that they were all set to 0.So, I modified the value of the first joint_stiffness(the one that turns the head left/right). When i re-run the echo the value was successfully changed.
Unfortunatly, when I try to run the command
ros2 topic pub --once effectors/joint_positions nao_command_msgs/msg/JointPositions '{indexes:{0}, positions:{1.57}}
the robot head still won’t move. Moreover, when I change the value of the stiffness of the head joint and I try to fisically turn the head ,it turns without any resistence as if the value of its stiffness is still set to 0.

I also noticed that it won’t let me change the stiffnesses of multiple joints with the same command(saying that the indexes and the stiffnesses arrays must be of the same size) and when I change the stiffness of other joints one by one it resets the others to 0.


As you said echoing the sensors/joint_stiffnesses topic i saw that they were all set to 0.So, I modified the value of the first joint_stiffness(the one that turns the head left/right). When i re-run the echo the value was successfully changed.

That’s a good start!

I also noticed that it won’t let me change the stiffnesses of multiple joints with the same command(saying that the indexes and the stiffnesses arrays must be of the same size)

From the logs, I see that the json is incorrectly getting interpreted. When you send multiple joint positions, in the terminal it says: “publishin #1: nao_command_msgs.msg.JointPositions(indexes=[0, 1, 2], positions=[1.0])”, where there is only value being interpreted for the positions array. So the json parser is probably not parsing your command correctly. Try doing:

ros2 topic pub effectors/joint_positions nao_command_msgs/msg/JointPositions '{indexes:[0,1,2], positions:[1.0,1.0,1.0]}'

Note the use of the square brackets for the arrays. If this is a mistake in one of the tutorials you followed, I would appreciate a pull request with the correct json :slight_smile:

when I change the stiffness of other joints one by one it resets the others to 0.

It is expected that when you change a joints’ stiffness, only that joint will be affected. The other joints’ stiffnesses shouldn’t change. This may be related to the issue above - the incorrect json formatting.If not, we could investigate why this is not behaving as expected.


If the stiffness of joint index 0 is 1.0 when you print out sensors/joint_stiffnesses, you should expect the head yaw joint to be stiff and not move around when you physically move it. I don’t know why this would happen.

Ok, I tryed to execute this command in the simulation and now I’m able to move multiple joints at the same time, so we at least we got this problem fixed.

No,this was on my bad, I followed the tutorial here: Getting Started — Rcss3d Nao documentation but, since there was no option for multiple joints move , I went with my guts.

Unfortunately that has nothing to do with the incorrect json formatting because it behaves the same way if I try to modify the stiffnesses one by one.

I was also sure that the stiffness of the joint of index 0 was set to 1.0 when i tryed to physically move the head horizontally because I took the screenshots of the previous answer before trying to do that.Is there something else I can do about that?

No,this was on my bad, I followed the tutorial here: Getting Started — Rcss3d Nao documentation but, since there was no option for multiple joints move , I went with my guts.

Thanks. The use of curly braces in the tutorial was misleading. I just updated it to use square brackets.

I was also sure that the stiffness of the joint of index 0 was set to 1.0 when i tryed to physically move the head horizontally because I took the screenshots of the previous answer before trying to do that.Is there something else I can do about that?

I have confirmation that the joint actuation works on a NAO V6 / Ubuntu 20.04 / ROS 2 Galactic combination, so I also expect it to work with the Ubuntu 22.04 / ROS 2 Humble combination.

Could you try:

  • Echo the joint positions on sensors/joint_positions (To check that LoLA is getting sensor information from the hardware)

    ie. ros2 topic echo sensors/joint_positions

  • Setting the color of the chest led of the robot? (To check that the robot responds to any actuation commands)

    ie. ros2 topic pub --once effectors/chest_led nao_command_msgs/msg/ChestLed "{ color: {r: 0.0, g: 0.0, b: 1.0}}"

HI Kenji!

We followed the naodevils procedure to create the image to flash. We did it on ubuntu 22.04.

Would you suggest us to do the same on ubu 20.04, and try again?

Thank! :slight_smile:

Hi @bnontn89,

I’d recommend continuing with Ubuntu 22.04 and try to resolve this issue. If you go back to 20.04 and use ROS 2 Galactic (which I have tested this stuff last year), Galactic has reached end of life a while ago and so it is not actively supported anymore.

1 Like

Hi again kenji ,I have some good and some bad news.
The good thing is that if I try to execute this command

the Nao’s chest led turns blue. I also tryed all the color combinations and it works fine aswell.
The bad thing is that I got some values output of the command

that won’t change if I try to move the robot head with the usual command

or if I physically move all the joints of the robot while echoing the sensors.Below you can find the screenshot of the situation(in the left terminal I also checked if the stiffness of the first joint was set to 1.0 with the command ros2 topic echo --once sensors/joint_stiffnesses)
So, to make it simple the leds works perfectly but the joints sensors won’t change values and the joints effectors won’t move.

the Nao’s chest led turns blue. I also tryed all the color combinations and it works fine aswell.

That’s a good start, it means that nao_lola is communicating with LoLA.

Which other topics are coming through correctly and which are not?

I don’t have anything that comes to mind, and unfortunately I don’t have a physical NAO with me to test this.

I’ve put together a bare-bone python script to test the NAO’s head yaw joint. Could you try and run it please? The script simply sets the stiffness of the nao’s head yaw to 1.0 and moves it to 1.57. If the head successfully moves, then there is likely a bug in Nao LoLA that we have to find. If the head doesn’t move, then the issue is likely in the Ubuntu 22.04 image or the hardware.

I posted this thread on robocup spl discord and got the following response:

Have they flashed the bot with the stock NaoOS 2.8.5 image first? This kinda sounds like the issue when motor boards have a newer firmware…

So maybe try that!

Hi @ijnek!

Which other topics are coming through correctly and which are not?

At the moment we tried only sensors/joint_positions that doesn’t work. We’ll make another test as soon as possible and we’ll try also your new python script.

Have they flashed the bot with the stock NaoOS 2.8.5 image first? This kinda sounds like the issue when motor boards have a newer firmware…

I am not sure what you are suggesting us… We used the nao devils instructions and the nao-2.8.5.11_ROBOCUP_ONLY_with_root.opn to create the image file to flash… (we also have the nao-2.8.5.10.opn file). What should we do? Flash the robot again with nao-2.8.5.10 without using the naodevils files?

In the chat with naodevils teams you wrote that we are using ros2 humble but we are actually using ros2 rolling as reported in the nao_lola docs.

Thanks again

Don’t run nao_lola when running this new python script, btw.

I am not sure what you are suggesting us… We used the nao devils instructions and the nao-2.8.5.11_ROBOCUP_ONLY_with_root.opn to create the image file to flash… (we also have the nao-2.8.5.10.opn file). What should we do? Flash the robot again with nao-2.8.5.10 without using the naodevils files?

I think the suggestion is to flash the robot with the nao-2.8.5.10.opn file you have once, in the hope that this fixes this motor board firmware issue. Then after that, flash the robot again with the Ubuntu22.04-based image you created. It may be better to ask in the chat on discord for more info, because I am not aware of this motor board problem.

In the chat with naodevils teams you wrote that we are using ros2 humble but we are actually using ros2 rolling as reported in the nao_lola docs.

No problem, that’s fine!

I have some good news, we successfully flashed an other Nao and now we are able to finally make its joints move! It was probably a problem about the flashing of the previous robot because we also tryed to execute this script

but still its joints won’t move and the led of his chest started to blink red.So we will soon reflash this robot like we did on the other to fix it.

I have some other questions:

  • is it an expected behavior that if I try to modify the stiffnesses of a nao joint it will make move that specific joint?Shouldn’t the change of position of the joints be relegated to just the joint_positions topic?
  • Also,why in the file joint_positions.msg there’s a LHIPYAWPITCH (index 7 of the array “indexes”) but not a right-one?
  • Finally, there is a way to change the stiffnesses of all the joints at the same time without passing all the indexes and the respectives stiffnesses into the topic?
    Thanks you in advice for your assistence,you have been very helpfull :slight_smile:

we were discussing here that in the simulation when I change the stiffness of a joint the others resets to 0.Today I tryed to do the same thing with the Nao that moves its joints and it still behavies the same way.I did the following:
-Setted the stiffness of the right shoulder to 1 withros2 topic pub --once effectors/joint_stiffnesses nao_command_msgs/msg/JointStiffnesses '{indexes:{20}, stiffnesses:{1.0}}' and the robot right shoulder goes to his default position(stretch horizontally).
-Change the shoulder position with ros2 topic pub --once effectors/joint_positions nao_command_msgs/msg/JointPositions '{indexes:{18}, positions:{-1.0}}' and its changed as expected
-Change the stiffness of the right elbow to make it move with ros2 topic pub --once effectors/joint_stiffnesses nao_command_msgs/msg/JointStiffnesses '{indexes:{20}, stiffnesses:{1.0}}'here the shoulder unforunatlly goes down due to the gravity and its stiffness resetted to 0 (as was confermed with echoing the sensors/joint_stiffnesses topic)
anyway after that the elbow rotates fine but with the shoulder down.
How can I avoid this behavior?I don’t know which joint I’m gonna use next so setting multiple stiffnesses at the same time at the beginnig of the test seems awkward.
As always you can find below the history of my logs.

I’ll go in order of easy questions to answer:

why in the file joint_positions.msg there’s a LHIPYAWPITCH (index 7 of the array “indexes”) but not a right-one?

This is related to the actual construction of the NAO. The robot physically doesn’t have a RHIPYAWPITCH joint. The LHIPYAWPITCH actuates the left and right leg symmetrically.

  • is it an expected behavior that if I try to modify the stiffnesses of a nao joint it will make move that specific joint?Shouldn’t the change of position of the joints be relegated to just the joint_positions topic?

Finally, there is a way to change the stiffnesses of all the joints at the same time without passing all the indexes and the respectives stiffnesses into the topic?

we were discussing here that in the simulation when I change the stiffness of a joint the others resets to 0

I think this is something I overlooked when I wrote this package originally due to lack of access to a physical robot (and no one was bothered to report it as an issue), so thank you for reporting it! I raised a gh issue, and also put together a fix on this branch this afternoon that should retain the position and stiffneses of joints. Could you build the branch from source and tell me how it goes? If it works as expected, I will merge it into rolling and make a binary release.

Thanks,
Kenji