diff --git a/Drone/client_setup.sh b/Drone/client_setup.sh index 69bc2e12..bf5bd267 100755 --- a/Drone/client_setup.sh +++ b/Drone/client_setup.sh @@ -48,7 +48,7 @@ systemctl restart dhcpcd cat << EOF | tee /etc/hostname $3 EOF -sed -i "/127.0.1.1/c 127.0.1.1 $3" /etc/hosts +sed -i "/127.0.1.1/c 127.0.1.1 $3 $3.local" /etc/hosts # set hostname for ROS sed -i "/ROS_HOSTNAME/c ROS_HOSTNAME=\'$3\'" /home/pi/.bashrc diff --git a/Drone/copter_client.py b/Drone/copter_client.py index 08dcd794..49339168 100644 --- a/Drone/copter_client.py +++ b/Drone/copter_client.py @@ -217,7 +217,7 @@ def configure_hosts(hostname): _ip, current_hostname = raw_content[index_start:index_stop].split() if current_hostname != hostname: - content = raw_content[:index_start] + "{} {}".format(_ip, hostname) + raw_content[index_stop:] + content = raw_content[:index_start] + "{} {} {}".format(_ip, hostname, hostname+'.local') + raw_content[index_stop:] try: with open(path, 'w') as f: f.write(content)