I recommend you to check the following threads about ultrasonic sensors with Galileo. You will find useful information regarding how to properly wire the sensor in case it's a 3-pin sensor. You will also find tips shared by other users for 3-pin and 4-pin sensors:
- 3 Pin ultrasonic sensor in galileo
- How can ı make 4pins ultrasonic sensor works?(In coding part)
- How Do I Run Ultrasonic Sensor on Galileo?
The threads above discuss the use of the ultrasonic sensor from the Arduino side. Since you are using the sensor with Python, I recommend you to write a Python script based on the Arduino examples. The ultrasonic sensor uses the pulseIn() method, you could check how this method works and try to write a similar method in Python based on the Arduino version. Please check the following thread: MRAA code for ultrasonic sensor. The user in that thread asked a similar question, she wanted to use the sensor in C++ so she ported the pulseIn() method from Arduino to hers own version to be used in C++. You might want to do a similar approach but using Python instead.
Additionally, there is an example code available for C++ here: upm/hcsr04.cxx at master · intel-iot-devkit/upm · GitHub. Unfortunately, there is not a Python version of it, but you could check the library used in that example and try to port it to Python.
I hope you find these suggestions useful.