Controlling robot via VM

I’m sorry the IP for Nvidia is 192.168.123.209, not 192.168.123.207.
This is the cat output from the Nvidia:

#auto lo
#iface lo inet loopback

#auto eth0
#iface eth0 inet static
#address 192.168.123.12
#netmask 255.255.255.0
#broadcast 192.168.123.255

#auto eth0:0
#iface eth0:0 inet static
#name Ethernet alias LAN card
#address 192.168.11.110
#netmask 255.255.255.0
#broadcast 192.168.11.255
#network 192.168.11.1

Thank you very much. I just requested the software package from support@mybotshop.de

I will give an update once I’ve installed and tested it :slight_smile:

Best regards
Tenzin

@Sohail, they are having a A1 Explorer with NVIDIA NX - But a very early one from Nov. 2021.

please
sudo nano /etc/network/interfaces
an un-comment all the items after you have completed the installation of the A1. The IP should return to 192.168.123.12 after you restart the robot or the network manager

sudo service NetworkManager restart

I was able to corrrectly install the software package (with internet). How should I proceed now regarding controlling the robot?
I tried:
sudo su
source ~/catkin_ws/devel/setup.bash
roslaunch qre_ros high_level_mode.launch

However, it said that lcm_server is unable to launch.

Thank you and best regards

Tenzin

Have you reverted the internet access by un-commenting the interfaces? Also, were there any errors during the installation of the packages in the Nvidia nx?

Yes, I uncommented the interface and now the IP changed back to 192.168.123.12 as intended. There was an error in the beginning when I didn’t have internet connection, but I deleted the catkin_ws folder and ran it again with internet access. It completed without errors.

When you re-ran with the internet connection, I’m expecting that you ran the install script and not catkin_make/ catkin build. If it has been successfully built, it means that the error is from it unable being to connect to the A1. If you have reset and un-commented.

Perhaps try restarting the A1 and running again:

sudo su
source ~/catkin_ws/devel/setup.bash
roslaunch qre_ros high_level_mode.launch

Also please share the ifconfig of the nvidia nx as well as the content in the final lines lf /home/unitree/.bashrc

I followed with tthe sudo su and source commands however the same error pops up.
I also noticed that the following line appears during startup:

-bash: //devel/setup.bash: No such file or directory

here is the ifconfig:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.123.12 netmask 255.255.255.0 broadcast 192.168.123.255
inet6 fd7a:2ebc:cc18:0:4ab0:2dff:fe50:c7a3 prefixlen 64 scopeid 0x0
inet6 fe80::4ab0:2dff:fe50:c7a3 prefixlen 64 scopeid 0x20
ether 48:b0:2d:50:c7:a3 txqueuelen 1000 (Ethernet)
RX packets 1819 bytes 685439 (685.4 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 612 bytes 81641 (81.6 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 37

eth0:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.11.110 netmask 255.255.255.0 broadcast 192.168.11.255
ether 48:b0:2d:50:c7:a3 txqueuelen 1000 (Ethernet)
device interrupt 37

lo: flags=4169<UP,LOOPBACK,RUNNING,MULTICAST> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1 (Local Loopback)
RX packets 606 bytes 441172 (441.1 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 606 bytes 441172 (441.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

rndis0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether ee:26:14:1e:f3:e1 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

usb0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether ee:26:14:1e:f3:e3 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

bashrc:

export PATH=/usr/local/cuda-10.2/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH
export GST_PLUGIN_PATH=/home/unitree/Unitree/autostart/04imageai/mLComSystemFrame/ThirdParty/webSinkPipe/build
source /opt/ros/melodic/setup.bash
source ~/catkin_ws/devel/setup.bash
export QRE_PATH=/home/unitree/catkin_ws
source /home/unitree/catkin_ws/utils/qre_unitree_envs.bash
export QRE_PATH=/
source //utils/qre_unitree_envs.bash
export QRE_PATH=/home/unitree/catkin_ws
source /home/unitree/catkin_ws/utils/qre_unitree_envs.bash
export QRE_PATH=/home/unitree/catkin_ws
source /home/unitree/catkin_ws/utils/qre_unitree_envs.bash
export QRE_PATH=/home/unitree/catkin_ws
source /home/unitree/catkin_ws/utils/qre_unitree_envs.bash
export QRE_PATH=/home/unitree/catkin_ws
source /home/unitree/catkin_ws/utils/qre_unitree_envs.bash
export QRE_PATH=/home/unitree/catkin_ws
source /home/unitree/catkin_ws/utils/qre_unitree_envs.bash
export QRE_PATH=/home/unitree/catkin_ws
source /home/unitree/catkin_ws/utils/qre_unitree_envs.bash
export QRE_PATH=/home/unitree/catkin_ws
source /home/unitree/catkin_ws/utils/qre_unitree_envs.bash
export QRE_PATH=/home/unitree/catkin_ws
source /home/unitree/catkin_ws/utils/qre_unitree_envs.bash

You can replace the following in the .bashrc after the source /opt/ros/melodic/setup.bash

source /opt/ros/melodic/setup.bash
source /home/unitree/catkin_ws/devel/setup.bash
export QRE_PATH=/home/unitree/catkin_ws
source /home/unitree/catkin_ws/utils/qre_unitree_envs.bash

Are you able to ping the other PC in the A1. This issue seems quite strange. Is anything else connected to the A1 via the Ethernet ports, if so please try removing it and reconnecting.

Also please do the following, if it still doesnt work.

cd
source.bashrc
cd catkin_ws
sudo rm -r /devel /build
catkin_make
source devel/setup.bash

If it still doesn’t work, try running the Unitree SDK directly without ROS. If the installation of the LCM by the install script was successful then if you go to the catkin_ws/utils/unitree_legged_sdk-3.2.0/examples folder. In there try running

sudo ./example_walk.cpp

The robot should start walking so be careful.

If this does not work, it means the installation of the LCM failed. For that, you must delete the catkin_ws, re-run the install script and carefully watch and make sure that when the build of the LCM reaches 100%. If it does not reach 100% then it means either a package is missing or the architecture/environment variables have not been set correctly.

If the issue persists, we can schedule a meeting!

One more thing that you can try is to install the provided package in your own PC/Laptop with ubuntu 18.04 (be sure to change the parameters as mentioned in the quadruped docs i.e. arm64 to amd64 both in unitree CMAKE and in the qre_unitree_envs.bash) and connecting it via Ethernet cable or Hotspot to the robot and running the same commands i.e.:

sudo su
source ~/catkin_ws/devel/setup.bash
roslaunch qre_ros high_level_mode.launch

Dear Sohail,

Thank you so much, now it launches without any errors. What would be the command to let the dog walk?

the sudo ./example_walk.cpp command does not work however.

Best regards

I also noticed that the IP of nvidia and pi of my robot is reversed compared to in docs.quadruped.de.
To access the nvidia board i have to use 192.168.123.12
and for pi: 192.168.123.161

image

That’s great to hear, what exactly solved the issue? To start moving the robot with the launch file you can use:

rosrun teleop_twist_keyboard teleop_twist_keyboard.py

ROS navigation tutorials are a place you can start for high-level control such as the ones given by the construct guys ROS Navigation.

If the ROS node is working then you can safely ignore the example_walk as in the back-end they are both communicating in the same way!

I believe that your A1 was one of the earlier versions and the IP standard was not set at that time. Therefore it had different ones.

I followed your instructions regarding the catkin_make commands. That did the job. Very grateful for your help.

I was able to control the robot now with the keyboard using teleop, which is great :slight_smile:

It would be great if we could run the example_dance file. Do you know how we could do that? Our goals is to run a file that we preconfigured/coded like example_dance or example_walk. We don’t necessarily need precise control over the robot.

Thank you and best regards

1 Like

It is possible to perform pre-configured tasks with ROS for A1, for running the examples try running

sudo su
./example_walk

Unfortunately this didn’t work. These are the steps i did:

  1. Start robot, connect to wifi and SSH into nvidia board
  2. cd into unitree_legged_sdk
  3. sudo su
  4. ./example_walk

Here is the error message:
image

I checked the file and my first thought was that maybe the IP in there is not correct? I tried changing it from 161 to 12 in the example_walk.cpp file and remake the build folder. This however did not work either and i resetted it again to 161.

This is the example walk file:

class Custom
{
public:
// Custom(uint8_t level): safe(LeggedType::A1), udp(8090, “192.168.123.11”, 8082, sizeof(HighCmd), sizeof(HighState)){
Custom(uint8_t level): safe(LeggedType::A1), udp(8090, “192.168.123.161”, 8082, sizeof(HighCmd), sizeof(HighState)){
udp.InitCmdData(cmd);
udp.SetDisconnectTime(dt, 1);
// udp.SetDisconnectTime(0, 0);
}
void UDPRecv();
void UDPSend();
void RobotControl();

Safety safe;
UDP udp;
HighCmd cmd = {0};
HighState state = {0};
int motiontime = 0;
float dt = 0.002;     // 0.001~0.01

};

void Custom::UDPRecv()
{
udp.Recv();
}

void Custom::UDPSend()
{
udp.Send();
}

void Custom::RobotControl()
{
motiontime += 2;
udp.GetRecv(state);

// printf("%f %f %f %f %f\n", state.imu.rpy[1], state.imu.rpy[2], state.position[0], state.position[1], state.velocity[0]);

cmd.mode = 0;
cmd.gaitType = 0;
cmd.speedLevel = 0;
cmd.footRaiseHeight = 0;
cmd.bodyHeight = 0;
cmd.euler[0]  = 0;
cmd.euler[1] = 0;
cmd.euler[2] = 0;
cmd.velocity[0] = 0.0f;
cmd.velocity[1] = 0.0f;
cmd.yawSpeed = 0.0f;


if(motiontime > 0 && motiontime < 1000){
    cmd.mode = 1;
    cmd.euler[0] = -0.3;
}
if(motiontime > 1000 && motiontime < 2000){
    cmd.mode = 1;
    cmd.euler[0] = 0.3;
}
if(motiontime > 2000 && motiontime < 3000){
    cmd.mode = 1;
    cmd.euler[1] = -0.2;
}
if(motiontime > 3000 && motiontime < 4000){
    cmd.mode = 1;
    cmd.euler[1] = 0.2;
}
if(motiontime > 4000 && motiontime < 5000){
    cmd.mode = 1;
    cmd.euler[2] = -0.2;
}
if(motiontime > 5000 && motiontime < 6000){
    cmd.mode = 1;
    cmd.euler[2] = 0.2;
}
if(motiontime > 6000 && motiontime < 7000){
    cmd.mode = 1;
    cmd.bodyHeight = -0.2;
}
if(motiontime > 7000 && motiontime < 8000){
    cmd.mode = 1;
    cmd.bodyHeight = 0.1;
}
if(motiontime > 8000 && motiontime < 9000){
    cmd.mode = 1;
    cmd.bodyHeight = 0.0;
}
if(motiontime > 9000 && motiontime < 11000){
    cmd.mode = 5;
}
if(motiontime > 11000 && motiontime < 13000){
    cmd.mode = 6;
}
if(motiontime > 13000 && motiontime < 14000){
    cmd.mode = 0;
}
if(motiontime > 14000 && motiontime < 18000){
    cmd.mode = 2;
    cmd.gaitType = 2;
    cmd.velocity[0] = 0.4f; // -1  ~ +1
    cmd.yawSpeed = 2;
    cmd.footRaiseHeight = 0.1;
    // printf("walk\n");
}
if(motiontime > 18000 && motiontime < 20000){
    cmd.mode = 0;
    cmd.velocity[0] = 0;
}
if(motiontime > 20000 && motiontime < 24000){
    cmd.mode = 2;
    cmd.gaitType = 1;
    cmd.velocity[0] = 0.2f; // -1  ~ +1
    cmd.bodyHeight = 0.1;
    // printf("walk\n");
}

if(motiontime>24000 ){
    cmd.mode = 1;
}

udp.SetSend(cmd);

}

int main(void)
{
std::cout << “Communication level is set to HIGH-level.” << std::endl
<< “WARNING: Make sure the robot is standing on the ground.” << std::endl
<< “Press Enter to continue…” << std::endl;
std::cin.ignore();

Custom custom(HIGHLEVEL);
// InitEnvironment();
LoopFunc loop_control("control_loop", custom.dt,    boost::bind(&Custom::RobotControl, &custom));
LoopFunc loop_udpSend("udp_send",     custom.dt, 3, boost::bind(&Custom::UDPSend,      &custom));
LoopFunc loop_udpRecv("udp_recv",     custom.dt, 3, boost::bind(&Custom::UDPRecv,      &custom));

loop_udpSend.start();
loop_udpRecv.start();
loop_control.start();

while(1){
    sleep(10);
};

return 0; 

}

Please execute it from the computer system in which the install script has been run.

Yes, I ran it where I ran the install script. It always says Error: Bind client ip&port failed.