Not sure you can easily get the spatial orientation of the robot from that function. If I understand how that function works, I have never used it as a cautionary tale, when one of the robot axes is pointing vertical and is stationary you can get the max reading on that axes sensor. The accelerometer physically is attached to the back of the tool flange so it makes sense that the coordinates are aligned with the robots tool flange coordinates.
To determine the orientation of the platform relative to gravity you will need to turn the accelerometer matrix into a rotation matrix and then use this to determine how the tool is currently oriented to gravity and then use the new gravity frame of reference and the tool frame of reference to determine the offsets to apply to the base. This is honestly way above the type of matrix manipulation that I normally perform. I did find a couple of things online doing a quick search and here are some links to the sites.
https://viriciti.com/blog/automatic-datahub-orientation/
https://stackoverflow.com/questions/8451710/compute-rotation-matrix-using-the-accelerometer
The real question is unless you are moving the robot enough out of the normal plane of gravity to cause faults is there a reason that you want to be computing the orientation of the base of the robot or are you trying to make the base regardless of orientation always be planar with a plane whose normal is in the direction of gravity?
I'm making this new thread because the older one went blocked and I cannot longer answer on it. This is what I asked:
I'm having some problems with my programming, hope some of you can help me.
So, the thing is I'm working on implementing the function get_tool_accelerometer_reading() but it says the return value is the acceleration respect the tool coordinates but I need the values to be respect the base coordinates in order to work with them. Is there anyway to change Tool coordinates into Base coordinates? I've been searching but I do not find anything.
ps: Is my approach right or am I terribly wrong on understing the return value of that function??
And answering to @matthewd92 who asked for a description of the use case, here it goes:
Of course, we are designing and application in which the robot is set on a movil platform, this means that the robot inclination is going to change. So what we want to know is if we can use this accelerometer function to get the acceleration and once we have that, obtain the position the robot is in that moment. We are working with coordinates relative to the base system that's why we needed the measure of the accelerometer to be also in that reference system and reading the description of the function we were not sure if the return values were relative to the base system or the tool system.
Hope is more clear now.
Thank you guys!
(also I wanted to create a discussion instead of a question but the category selection didn't seem to be working for me).