In this tutorial I will explain to the reader how to sensor values are read from Simulators. This tutorial should only take the reader less than 15min if they already have the needed software set up. If the reader does not have PODO, Xenomai, ROS, etc. installed please refer to the previous tutorials first. I will also recommend that the reader have either a large monitor or dual monitor setup. As some of the windows will be horizontally long.
1. Open Daemon, start the simulators (rviz and gazebo), then open qt to run the PODOGUI. Once open open the walk ready AL in the module tab.
2. Now open the Joints and Sensors tabs on the bottom left of the GUI. These are the tabs where you will be able to see the reading from the the various joint encoders and ft sensors on DRC-Hubo.
3. Once open click on the enable buttons on both tabs. This will make sure that the joint encoders and ft sensors are going to show readings in the tabs.
4. If you run the walk ready pose these new tabs will show you how many degrees each joint is moving and how much force and torque is exerted. This video shows an example of what you should see.
5. However, if you do not need to see how the model reacts to the environment and just want to test a movement you can open the simulator tab.
This tab will allow you to only see the movement of the robot. However the waist is stuck in it's position so some movements will not look as they were meant.
Since we were able to read the feedback in the GUI this also means that we can use the feedback in an AL program. Since all of the data goes to shared memory it is possible to use it anywhere within PODO. If you go back to the code of the GUI you will find different code needed to get the sensor information from shared memory.
Open qt and open the SensorDialog.cpp you will be able to see how the GUI was able to get the sensor data from shared memory. In the SensorDialog you can see that each value is coming from PODO_DATA. However this is what you will probably not use. PODO_Data is used specifically for displaying in the GUI.
It is the same for the joint encoders. If you go to the JointDialog.cpp file you will see that there is a specific function for displaying joint encoder data. This in itself is not helpful if you need to include the encoder data into your AL.
The line of code needed starts with sharedSEN. The reason I say 'starts' is because there are many ways you can go after sharedSEN. As you will continuously point to a more and more specific place to find the data you want. 'sharedSEN' can then point you to encoder, IMU, FOG, FT, etc. data in shared memory. Then depending on which you choose you can also point further to a specific piece of data from a sensor.
But you will need to know which sensor you want to get data from specifically. If you hold your mouse over a pointer for long enough it will show you the syntax for the sensor data type. You can use the huboi to make sure you are getting the correct data.
If you wonder more specifically about the syntax right click the data type and select 'Follow Symbol Under Cursor'. That will take you to where the data type was defined and the meaning of the syntax.
You can easily move from one pointer to another by typing a period after choosing one. This is a quick video that shows how to move from one pointer to another and to find the syntax.
I would recommend that you play around with the different data types and what kind of data you get. You can see this by using the
cout<<[variable you put the data type into]<<endl
This code will output the data as a message in Daemon when run.