[Unitree Go1] Obstacle avoidance and localization

Dear Sohail,

I hope this message finds you well. I’m reaching out for your expertise on a few specific queries related to the qre_go1 repository on the noetic_robotis branch:

  1. Does this controller version facilitate obstacle avoidance? If so, could you elucidate its mechanism?
  2. What are the capabilities concerning localization within this framework?
  3. In Rviz, is there a way to input a goal position for the robot, prompting it to navigate towards that point?

The reason behind these inquiries is my current project involving the development of a Reinforcement Learning (RL) algorithm. For this, I need to gather data from the GO1, particularly from its Lidar and front camera. The objective is to set up a realistic or simulated environment for data collection, which will be stored in a replay buffer. The desired observations include environment status (like completion flags), the robot’s state, its linear and angular velocities, and camera and lidar outputs. I’m contemplating whether to collect this data manually using the actual robot or through a simulation.

Your guidance on these matters would be greatly appreciated.

Thank you,
Amir

Dear @Amir_Mahdi,

  1. By default no, but if you are receiving a /scan message from the Lidar then it can be activated using the go1_navigation ros package. Once it receives it, it should be able to successfully avoid obstacle.
  2. Localization is the normal 2D localization which works well in most cases using adaptive monte carlo localization algorithm or AMCL. It is in the qre_go1.
  3. Yes, once the go1_bringup. and go1_navigation is running you can give a 2D Nav Goal in Rviz while avoiding obstacles. (Before this you have to perform slam and save the map)

I would recommend viewing the tutorials in the pdf in the melodic-robotis branch so that you can get a proper overview of ROS.

The reason behind these inquiries is my current project involving the development of a Reinforcement Learning (RL) algorithm. For this, I need to gather data from the GO1, particularly from its Lidar and front camera. The objective is to set up a realistic or simulated environment for data collection, which will be stored in a replay buffer. The desired observations include environment status (like completion flags), the robot’s state, its linear and angular velocities, and camera and lidar outputs. I’m contemplating whether to collect this data manually using the actual robot or through a simulation.
Your guidance on these matters would be greatly appreciated.

I would recommend performing in the real robot as simulations for quadruped generally do not translate well into the real world unlike differential or omni wheel drive robots.

Regards,
S. O. Sohail

Thank you for your reply Sohail. Can you please guide me through the following questions:

  1. I can access all of these in a high-level mode, right? Or should I connect via LAN in low-level mode?

  2. If I want access to the /scan topic, I should connect to the GO1 via wifi (because there is only one port on the robot. This can be used either for the LAN connection or LiDAR connection.) Am I right?

  3. I know that the robot can create a map env by the slam of the robot (I saw that my colleague created a map on its mobile phone with the unitree mobile application). Can I do that by using your packages?

  4. When I have created the map, where should I save this map, and how to use it?

Thank you for your great support.

Kind regard,
Amir

  1. I can access all of these in a high-level mode, right? Or should I connect via LAN in low-level mode?

I am not sure what you are asking about? However, the topics such as odom and joint states should be visible.

  1. If I want access to the /scan topic, I should connect to the GO1 via wifi (because there is only one port on the robot. This can be used either for the LAN connection or LiDAR connection.) Am I right?

This complex, easiest would be to get an ethernet switch to allow access to more ports otherwise you have to do port forwarding and linking of the ips. From what I have understood, you robot has a ros master already running in either pi or the nvidias, if you connect via the LAN cable and configure your pc to have ros multi-machine setup correctly configured then you should be able to see the scan topics directly.

If you the WiFi route, setting mutlimachine may prove to be quite challenging and lengthy if you are not familiar with the process/

  1. I know that the robot can create a map env by the slam of the robot (I saw that my colleague created a map on its mobile phone with the unitree mobile application). Can I do that by using your packages?

Yes, f you receive the scan topic and configure the go1_navigation it should be able to perform SLAM as well as map based navigation quite well. (We have tested this)

  1. When I have created the map, where should I save this map, and how to use it?

Once its saved place it in go1_navigation maps folder, change the name of the map in go1_navigation/launch/include/custom_map_server.xml and execute.

roslaunch go1_navigation map_navi.launch

I used this, as you mentioned, for the ethernet switch. The white cable is now connected to my laptop and the robot. The lidar is connected to the robot with this ethernet switch.

if you connect via the LAN cable and configure your pc to have ros multi-machine setup correctly configured, then you should be able to see the scan topics directly.

Could you please guide me step by step on how I can configure my PC to have ROS multi-machine setup? (For /scan and front camera topics?)

When I set this configuration, I can see all the topics on my PC, right?

Dear Sohail,

I could set up ROS multi-machine via Wifi. I think I couldn’t find the scan topic via LAN because of the ethernet switcher in the previous image. Do you have any idea how to fix this issue? Because the data from Lidar was not transmitting.

Dear Mahdi,

I am not sure that it will work in the Wifi. Please check in the 4 pcs (x1 pi, x3 Nvidia) in the

~/.bashrc

file where the ROS Master is setup. From there copy the one which does not have the same ip setup. It should look something like this

export ROS_MASTER_URI=http://192.168.123.161:11311/
export ROS_IP=192.168.123.161
export ROS_HOSTNAME=192.168.123.161

if the ROS_MASTER_URI and the ROS_IP that pc is the master and all others are slaves. The slaves will look something like this

export ROS_MASTER_URI=http://192.168.123.161:11311/
export ROS_IP=192.168.123.14
export ROS_HOSTNAME=192.168.123.14

What you have to do is find out the ROS_MASTER_URI which can be done by ssh’ing into one of the go1_computers where the scan topic is coming and running

echo $ROS_MASTER_URI
echo $ROS_IP
echo $ROS_HOSTNAME

Then in your own PC you can add the following exports to your ~/.bashrc file e.g.

export ROS_MASTER_URI=http://<The IP you found while echoing>:11311/
export ROS_IP=192.168.123.52 # Your static lan ip
export ROS_HOSTNAME=192.168.123.52

Then source the .bashrc

source ~/.bashrc

The topic should then show up on your PC.

Dear Sohail,

Thank you for your reply.

I could perform SLAM, and I saw the robot and the map. However, there is an issue here:

There is an issue in the image. There are two links here. /base_link & /base. The robot is spawned at the /base link. This is wrong. The robot should spawn at /base_link. Can you guide me on how I can do that?

I have another question. Why don’t I see the camera output on RViz? I mean, the topic is publishing point-cloud data, but RViz cannot show it.

There is an issue in the image. There are two links here. /base_link & /base. The robot is spawned at the /base link. This is wrong. The robot should spawn at /base_link. Can you guide me on how I can do that?

There is no issue, the convention is that usually the main frame of the robot is called base_link, however, unitree has named their link base, so to enable compatibility with their work flow as well as ROS convention (as many native ROS packages are dependent on the robot having base_link), we have added a in the go1_description urdf file a fixed joint. Feel free to modify it according to your requirements.

I have another question. Why don’t I see the camera output on RViz? I mean, the topic is publishing point-cloud data, but RViz cannot show it.

Can you echo the topic to check if the data is having an output on the terminal? If not then it means the data is not being received from the point cloud driver.

Yes, it is being publish as follows:

header:
seq: 1674
stamp:
secs: 1536093402
nsecs: 272387028
frame_id: “trunk”
height: 1
width: 753
fields:

name: "x"
offset: 0
datatype: 7
count: 1
  • name: “y”
    offset: 4
    datatype: 7
    count: 1
  • name: “z”
    offset: 8
    datatype: 7
    count: 1
  • name: “rgb”
    offset: 16
    datatype: 7
    count: 1
    is_bigendian: False
    point_step: 32
    row_step: 24096
    data: [67, 240, 179, 62, 243, 190, 153, 189, 240, 171, 147, 190, 0, 0, 128, 63, 87, 89, 83, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 122, 51, 180, 62, 55, 2, 139, 189, 186, 27, 147, 190, 0, 0, 128, 63, 89, 91, 85, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 170, 101, 182, 62, 231, 135, 141, 189, 188, 68, 146, 190, 0, 0, 128, 63, 93, 95, 89, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 132, 11, 181, 62, 78, 142, 94, 189, 246, 239, 147, 92, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 29, 12, 217, 62, 254, 84, 251, 61, 88, 110, 160, 190, 0, 0, 128, 63, 106, 111, 107, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 78, 35, 214, 62, 67, 234, 17, 62, 190, 51, 166, 190, 0, 0, 128, 63, 99, 106, 100, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 220, 61, 217, 62, 71, 19, 20, 62, 238, 69, 164, 190, 0, 0, 128, 63, 101, 105, 100, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 26, 153, 213, 62, 240, 34, 28, 62, 92, 172, 166, 190, 0, 0, 128, 63, 90, 97, 90, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 172, 168, 216, 62, 105, 101, 30, 62, 84, 168, 164, 190, 0, 0, 128, 63, 92, 96, 91, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 109, 31, 214, 62, 16, 77, 48, 62, 234, 41, 162, 190, 0, 0, 128, 63, 106, 114, 104, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 194, 207, 213, 62, 6, 143, 28, 190, 172, 166, 152, 190, 0, 0, 128, 63, 92, 99, 95, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 20, 211, 218, 62, 66, 245, 23, 190, 84, 120, 153, 190, 0, 0, 128, 63, 96, 103, 100, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 130, 215, 216, 62, 107, 33, 12, 190, 196, 52, 156, 190, 0, 0, 128, 63, 78, 86, 85, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 181, 225, 221, 62, 97, 184, 6, 190, 164, 239, 156, 190, 0, 0, 128, 63, 91, 98, 96, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 150, 96, 218, 62, 229, 29, 241, 189, 56, 106, 156, 190, 0, 0, 128, 63, 96, 102, 97, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 122, 82, 223, 62, 243, 214, 228, 189, 162, 0, 157, 190, 0, 0, 128, 63, 91, 98, 95, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 38, 138, 221, 62, 56, 162, 201, 189, 82, 123, 151, 190, 0, 0, 128, 63, 96, 103, 98, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 120, 230, 220, 62, 68, 206, 178, 189, 44, 193, 148, 190, 0, 0, 128, 63, 95, 102, 96, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 30, 44, 219, 62, 213, 140, 158, 189, 238, 203, 152, 190, 0, 0, 128, 63, 96, 103, 96, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 112, 95, 222, 62, 78, 153, 161, 189, 228, 241, 150, 190, 0, 0, 128, 63, 92, 99, 92, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 179, 124, 219, 62, 228, 193, 109, 189, 136, 143, 151, 190, 0, 0, 128, 63, 96, 103, 98, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 246, 190, 222, 62, 150, 127, 74, 189, 110, 16, 149, 190, 0, 0, 128, 63, 98, 105, 100, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 3, 89, 218, 62, 74, 52, 28, 189, 58, 108, 147, 190, 0, 0, 128, 63, 99, 105, 100, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 25, 150, 221, 62, 208, 204, 31, 189, 246, 212, 145, 190, 0, 0, 128, 63, 97, 105, 98, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 114, 59, 219, 62, 44, 155, 47, 188, 84, 44, 148, 190, 0, 0, 128, 63, 99, 107, 99, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 18, 13, 223, 62, 53, 228, 169, 188, 56, 25, 148, 190, 0, 0, 128, 63, 94, 103, 93, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 134, 151, 219, 62, 136, 84, 203, 186, 76, 205, 148, 190, 0, 0, 128, 63, 98, 106, 99, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 191, 236, 222, 62, 32, 230, 231, 186, 140, 78, 147, 190, 0, 0, 128, 63, 95, 104, 94, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 107, 243, 217, 62, 171, 156, 211, 60, 226, 23, 145, 190, 0, 0, 128, 63, 97, 102, 95, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 178, 55, 221, 62, 88, 17, 214, 60, 10, 164, 143, 190, 0, 0, 128, 63, 97, 103, 94, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 212, 121, 217, 62, 150, 136, 51, 61, 110, 158, 144, 190, 0, 0, 128, 63, 98, 103, 94, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 242, 8, 221, 62, 234, 178, 16, 61, 118, 125, 143, 190, 0, 0, 128, 63, 96, 101, 92, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 4, 125, 216, 62, 160, 238, 123, 61, 248, 101, 143, 190, 0, 0, 128, 63, 101, 105, 100, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 194, 65, 220, 62, 172, 56, 91, 61, 212, 155, 142, 190, 0, 0, 128, 63, 97, 101, 95, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 90, 213, 216, 62, 220, 157, 164, 61, 210, 192, 145, 190, 0, 0, 128, 63, 101, 103, 103, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 160, 222, 220, 62, 70, 29, 149, 61, 164, 66, 145, 190, 0, 0, 128, 63, 100, 102, 101, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 191, 0, 222, 62, 204, 102, 191, 61, 42, 149, 149, 190, 0, 0, 128, 63, 97, 99, 100, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 243, 225, 221, 62, 148, 207, 211, 61, 120, 101, 150, 190, 0, 0, 128, 63, 104, 104, 105, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 44, 161, 221, 62, 92, 118, 237, 61, 40, 134, 160, 190, 0, 0, 128, 63, 104, 106, 106, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 48, 29, 226, 62, 217, 81, 244, 61, 68, 66, 161, 190, 0, 0, 128, 63, 109, 109, 109, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 73, 138, 221, 62, 186, 89, 24, 62, 72, 13, 165, 190, 0, 0, 128, 63, 98, 102, 99, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 160, 200, 224, 62, 142, 153, 26, 62, 106, 217, 162, 190, 0, 0, 128, 63, 105, 109, 107, 255 …, 5, 0, 0, 0, 0, 0, 0, 0, 105, 206, 225, 62, 127, 87, 253, 189, 148, 172, 154, 190, 0, 0, 128, 63, 93, 100, 97, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 180, 30, 231, 62, 151, 179, 240, 189, 12, 30, 155, 190, 0, 0, 128, 63, 99, 106, 103, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 184, 232, 225, 62, 49, 144, 208, 189, 90, 249, 151, 190, 0, 0, 128, 63, 98, 105, 100, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 72, 0, 231, 62, 114, 152, 194, 189, 58, 57, 152, 190, 0, 0, 128, 63, 96, 103, 98, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 141, 127, 229, 62, 49, 119, 151, 189, 218, 57, 156, 190, 0, 0, 128, 63, 105, 109, 109, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 186, 13, 234, 62, 91, 28, 179, 189, 42, 80, 157, 190, 0, 0, 128, 63, 95, 103, 96, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 5, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 96, 56, 150, 63, 69, 223, 153, 61, 216, 196, 129, 190, 0, 0, 128, 63, 96, 80, 70, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 59, 119, 144, 63, 141, 206, 220, 61, 112, 3, 141, 190, 0, 0, 128, 63, 57, 58, 64, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 241, 125, 148, 63, 175, 113, 23, 62, 51, 195, 127, 190, 0, 0, 128, 63, 87, 73, 63, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 141, 157, 145, 63, 48, 213, 57, 62, 88, 135, 143, 190, 0, 0, 128, 63, 45, 54, 67, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 247, 141, 147, 63, 168, 52, 99, 62, 152, 18, 147, 190, 0, 0, 128, 63, 51, 55, 66, 255, 127, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0]
    is_dense: True

I received this error message:

Transform [sender=unknown_publisher]
Message removed because it is too old (frame=[trunk], stamp=[1536093805.157948971])