unitreerobotics / unitree_legged_sdk

SDK tools for control robots.
BSD 3-Clause "New" or "Revised" License
298 stars 165 forks source link

How to access HighState while doing low level control? #113

Open sharathmatada opened 1 year ago

sharathmatada commented 1 year ago

Hi, I'm trying to do low-level control but would like to use the in-built state estimator and would like to access the variables in HighState to perform low level control. Any leads on this will be helpful

xyq1223 commented 1 year ago

Hello,we are very sorry that we do not support this at the moment.

heartInsert commented 4 months ago

@xyq1223 mate , do you know how to get /gazebo/model_states and /aliengo_gazebo/joint_states in a real robot ?

alvarobelmontebaeza commented 6 days ago

Hi! Is there a way to get the estimated state while in low level mode? Or access the state estimator separately and run it ourselves while in low state mode? Why can't the state estimator keep working while in lowlevel control mode?

heartInsert commented 5 days ago

Hi! Is there a way to get the estimated state while in low level mode? Or access the state estimator separately and run it ourselves while in low state mode? Why can't the state estimator keep working while in lowlevel control mode?

what is estimated state ?

alvarobelmontebaeza commented 5 days ago

Hi! Is there a way to get the estimated state while in low level mode? Or access the state estimator separately and run it ourselves while in low state mode? Why can't the state estimator keep working while in lowlevel control mode?

what is estimated state ?

When running the SDK in HighLevel mode, one can access to an estimate of the robot body position and velocity, which I assume is inferred by a built-in state estimator that leverages the onboard sensors of the robot as well as maybe leg kinematics. The problem is that when switching to LowLevel mode, you cannot access that information anymore, which doesn't make sense to me because state estimation should not be coupled to the joint commands outputed by the built-in controller in highlevel mode.

heartInsert commented 5 days ago

@alvarobelmontebaeza Oh , do you mean you want to get robot's body position and velocity in low level ? It's definitely could , because I used to access these information by Ros , and I run my RL model in real robot in low_level control successfully.

alvarobelmontebaeza commented 5 days ago

@heartInsert Are you sure? I mean, the reason for this topic is issue is that the estimated state is not accessible in LowLevel mode. When you set the robot into lowlevel mode, it stops updating the values of the highLevel state message.

If it is working for you, could you share some code?

heartInsert commented 5 days ago

@alvarobelmontebaeza I don't know what messages you want , I remember that I can get robot's 12 joint's position and acceleration and orientation , all of these information is updated all the time , do you want these ? I didn't run my robot in High-level , so I don't know the information in High-level.

alvarobelmontebaeza commented 5 days ago

That information is joint-level information and IMU sensor raw info, which is quite noisy and you cannot really rely on that. If you run in HighLevel mode, you get also an estimate of global position and velocity of the body, which is what I'm interested in. Maybe @xyq1223 who replied earlier in this thread has more insight