id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
235,400
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
roll_estimate
def roll_estimate(RAW_IMU,GPS_RAW_INT=None,ATTITUDE=None,SENSOR_OFFSETS=None, ofs=None, mul=None,smooth=0.7): '''estimate roll from accelerometer''' rx = RAW_IMU.xacc * 9.81 / 1000.0 ry = RAW_IMU.yacc * 9.81 / 1000.0 rz = RAW_IMU.zacc * 9.81 / 1000.0 if ATTITUDE is not None and GPS_RAW_INT is not No...
python
def roll_estimate(RAW_IMU,GPS_RAW_INT=None,ATTITUDE=None,SENSOR_OFFSETS=None, ofs=None, mul=None,smooth=0.7): '''estimate roll from accelerometer''' rx = RAW_IMU.xacc * 9.81 / 1000.0 ry = RAW_IMU.yacc * 9.81 / 1000.0 rz = RAW_IMU.zacc * 9.81 / 1000.0 if ATTITUDE is not None and GPS_RAW_INT is not No...
[ "def", "roll_estimate", "(", "RAW_IMU", ",", "GPS_RAW_INT", "=", "None", ",", "ATTITUDE", "=", "None", ",", "SENSOR_OFFSETS", "=", "None", ",", "ofs", "=", "None", ",", "mul", "=", "None", ",", "smooth", "=", "0.7", ")", ":", "rx", "=", "RAW_IMU", "....
estimate roll from accelerometer
[ "estimate", "roll", "from", "accelerometer" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L294-L313
235,401
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
mag_rotation
def mag_rotation(RAW_IMU, inclination, declination): '''return an attitude rotation matrix that is consistent with the current mag vector''' m_body = Vector3(RAW_IMU.xmag, RAW_IMU.ymag, RAW_IMU.zmag) m_earth = Vector3(m_body.length(), 0, 0) r = Matrix3() r.from_euler(0, -radians(inclination)...
python
def mag_rotation(RAW_IMU, inclination, declination): '''return an attitude rotation matrix that is consistent with the current mag vector''' m_body = Vector3(RAW_IMU.xmag, RAW_IMU.ymag, RAW_IMU.zmag) m_earth = Vector3(m_body.length(), 0, 0) r = Matrix3() r.from_euler(0, -radians(inclination)...
[ "def", "mag_rotation", "(", "RAW_IMU", ",", "inclination", ",", "declination", ")", ":", "m_body", "=", "Vector3", "(", "RAW_IMU", ".", "xmag", ",", "RAW_IMU", ".", "ymag", ",", "RAW_IMU", ".", "zmag", ")", "m_earth", "=", "Vector3", "(", "m_body", ".", ...
return an attitude rotation matrix that is consistent with the current mag vector
[ "return", "an", "attitude", "rotation", "matrix", "that", "is", "consistent", "with", "the", "current", "mag", "vector" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L342-L353
235,402
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
mag_yaw
def mag_yaw(RAW_IMU, inclination, declination): '''estimate yaw from mag''' m = mag_rotation(RAW_IMU, inclination, declination) (r, p, y) = m.to_euler() y = degrees(y) if y < 0: y += 360 return y
python
def mag_yaw(RAW_IMU, inclination, declination): '''estimate yaw from mag''' m = mag_rotation(RAW_IMU, inclination, declination) (r, p, y) = m.to_euler() y = degrees(y) if y < 0: y += 360 return y
[ "def", "mag_yaw", "(", "RAW_IMU", ",", "inclination", ",", "declination", ")", ":", "m", "=", "mag_rotation", "(", "RAW_IMU", ",", "inclination", ",", "declination", ")", "(", "r", ",", "p", ",", "y", ")", "=", "m", ".", "to_euler", "(", ")", "y", ...
estimate yaw from mag
[ "estimate", "yaw", "from", "mag" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L355-L362
235,403
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
mag_roll
def mag_roll(RAW_IMU, inclination, declination): '''estimate roll from mag''' m = mag_rotation(RAW_IMU, inclination, declination) (r, p, y) = m.to_euler() return degrees(r)
python
def mag_roll(RAW_IMU, inclination, declination): '''estimate roll from mag''' m = mag_rotation(RAW_IMU, inclination, declination) (r, p, y) = m.to_euler() return degrees(r)
[ "def", "mag_roll", "(", "RAW_IMU", ",", "inclination", ",", "declination", ")", ":", "m", "=", "mag_rotation", "(", "RAW_IMU", ",", "inclination", ",", "declination", ")", "(", "r", ",", "p", ",", "y", ")", "=", "m", ".", "to_euler", "(", ")", "retur...
estimate roll from mag
[ "estimate", "roll", "from", "mag" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L370-L374
235,404
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
expected_mag
def expected_mag(RAW_IMU, ATTITUDE, inclination, declination): '''return expected mag vector''' m_body = Vector3(RAW_IMU.xmag, RAW_IMU.ymag, RAW_IMU.zmag) field_strength = m_body.length() m = rotation(ATTITUDE) r = Matrix3() r.from_euler(0, -radians(inclination), radians(declination)) m_ea...
python
def expected_mag(RAW_IMU, ATTITUDE, inclination, declination): '''return expected mag vector''' m_body = Vector3(RAW_IMU.xmag, RAW_IMU.ymag, RAW_IMU.zmag) field_strength = m_body.length() m = rotation(ATTITUDE) r = Matrix3() r.from_euler(0, -radians(inclination), radians(declination)) m_ea...
[ "def", "expected_mag", "(", "RAW_IMU", ",", "ATTITUDE", ",", "inclination", ",", "declination", ")", ":", "m_body", "=", "Vector3", "(", "RAW_IMU", ".", "xmag", ",", "RAW_IMU", ".", "ymag", ",", "RAW_IMU", ".", "zmag", ")", "field_strength", "=", "m_body",...
return expected mag vector
[ "return", "expected", "mag", "vector" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L376-L387
235,405
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
gravity
def gravity(RAW_IMU, SENSOR_OFFSETS=None, ofs=None, mul=None, smooth=0.7): '''estimate pitch from accelerometer''' if hasattr(RAW_IMU, 'xacc'): rx = RAW_IMU.xacc * 9.81 / 1000.0 ry = RAW_IMU.yacc * 9.81 / 1000.0 rz = RAW_IMU.zacc * 9.81 / 1000.0 else: rx = RAW_IMU.AccX ...
python
def gravity(RAW_IMU, SENSOR_OFFSETS=None, ofs=None, mul=None, smooth=0.7): '''estimate pitch from accelerometer''' if hasattr(RAW_IMU, 'xacc'): rx = RAW_IMU.xacc * 9.81 / 1000.0 ry = RAW_IMU.yacc * 9.81 / 1000.0 rz = RAW_IMU.zacc * 9.81 / 1000.0 else: rx = RAW_IMU.AccX ...
[ "def", "gravity", "(", "RAW_IMU", ",", "SENSOR_OFFSETS", "=", "None", ",", "ofs", "=", "None", ",", "mul", "=", "None", ",", "smooth", "=", "0.7", ")", ":", "if", "hasattr", "(", "RAW_IMU", ",", "'xacc'", ")", ":", "rx", "=", "RAW_IMU", ".", "xacc"...
estimate pitch from accelerometer
[ "estimate", "pitch", "from", "accelerometer" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L428-L449
235,406
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
pitch_sim
def pitch_sim(SIMSTATE, GPS_RAW): '''estimate pitch from SIMSTATE accels''' xacc = SIMSTATE.xacc - lowpass(delta(GPS_RAW.v,"v")*6.6, "v", 0.9) zacc = SIMSTATE.zacc zacc += SIMSTATE.ygyro * GPS_RAW.v; if xacc/zacc >= 1: return 0 if xacc/zacc <= -1: return -0 return degrees(-as...
python
def pitch_sim(SIMSTATE, GPS_RAW): '''estimate pitch from SIMSTATE accels''' xacc = SIMSTATE.xacc - lowpass(delta(GPS_RAW.v,"v")*6.6, "v", 0.9) zacc = SIMSTATE.zacc zacc += SIMSTATE.ygyro * GPS_RAW.v; if xacc/zacc >= 1: return 0 if xacc/zacc <= -1: return -0 return degrees(-as...
[ "def", "pitch_sim", "(", "SIMSTATE", ",", "GPS_RAW", ")", ":", "xacc", "=", "SIMSTATE", ".", "xacc", "-", "lowpass", "(", "delta", "(", "GPS_RAW", ".", "v", ",", "\"v\"", ")", "*", "6.6", ",", "\"v\"", ",", "0.9", ")", "zacc", "=", "SIMSTATE", ".",...
estimate pitch from SIMSTATE accels
[ "estimate", "pitch", "from", "SIMSTATE", "accels" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L453-L462
235,407
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
distance_home
def distance_home(GPS_RAW): '''distance from first fix point''' global first_fix if (hasattr(GPS_RAW, 'fix_type') and GPS_RAW.fix_type < 2) or \ (hasattr(GPS_RAW, 'Status') and GPS_RAW.Status < 2): return 0 if first_fix == None: first_fix = GPS_RAW return 0 return...
python
def distance_home(GPS_RAW): '''distance from first fix point''' global first_fix if (hasattr(GPS_RAW, 'fix_type') and GPS_RAW.fix_type < 2) or \ (hasattr(GPS_RAW, 'Status') and GPS_RAW.Status < 2): return 0 if first_fix == None: first_fix = GPS_RAW return 0 return...
[ "def", "distance_home", "(", "GPS_RAW", ")", ":", "global", "first_fix", "if", "(", "hasattr", "(", "GPS_RAW", ",", "'fix_type'", ")", "and", "GPS_RAW", ".", "fix_type", "<", "2", ")", "or", "(", "hasattr", "(", "GPS_RAW", ",", "'Status'", ")", "and", ...
distance from first fix point
[ "distance", "from", "first", "fix", "point" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L500-L510
235,408
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
sawtooth
def sawtooth(ATTITUDE, amplitude=2.0, period=5.0): '''sawtooth pattern based on uptime''' mins = (ATTITUDE.usec * 1.0e-6)/60 p = fmod(mins, period*2) if p < period: return amplitude * (p/period) return amplitude * (period - (p-period))/period
python
def sawtooth(ATTITUDE, amplitude=2.0, period=5.0): '''sawtooth pattern based on uptime''' mins = (ATTITUDE.usec * 1.0e-6)/60 p = fmod(mins, period*2) if p < period: return amplitude * (p/period) return amplitude * (period - (p-period))/period
[ "def", "sawtooth", "(", "ATTITUDE", ",", "amplitude", "=", "2.0", ",", "period", "=", "5.0", ")", ":", "mins", "=", "(", "ATTITUDE", ".", "usec", "*", "1.0e-6", ")", "/", "60", "p", "=", "fmod", "(", "mins", ",", "period", "*", "2", ")", "if", ...
sawtooth pattern based on uptime
[ "sawtooth", "pattern", "based", "on", "uptime" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L512-L518
235,409
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
EAS2TAS
def EAS2TAS(ARSP,GPS,BARO,ground_temp=25): '''EAS2TAS from ARSP.Temp''' tempK = ground_temp + 273.15 - 0.0065 * GPS.Alt return sqrt(1.225 / (BARO.Press / (287.26 * tempK)))
python
def EAS2TAS(ARSP,GPS,BARO,ground_temp=25): '''EAS2TAS from ARSP.Temp''' tempK = ground_temp + 273.15 - 0.0065 * GPS.Alt return sqrt(1.225 / (BARO.Press / (287.26 * tempK)))
[ "def", "EAS2TAS", "(", "ARSP", ",", "GPS", ",", "BARO", ",", "ground_temp", "=", "25", ")", ":", "tempK", "=", "ground_temp", "+", "273.15", "-", "0.0065", "*", "GPS", ".", "Alt", "return", "sqrt", "(", "1.225", "/", "(", "BARO", ".", "Press", "/",...
EAS2TAS from ARSP.Temp
[ "EAS2TAS", "from", "ARSP", ".", "Temp" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L556-L559
235,410
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
airspeed_voltage
def airspeed_voltage(VFR_HUD, ratio=None): '''back-calculate the voltage the airspeed sensor must have seen''' import mavutil mav = mavutil.mavfile_global if ratio is None: ratio = 1.9936 # APM default if 'ARSPD_RATIO' in mav.params: used_ratio = mav.params['ARSPD_RATIO'] else: ...
python
def airspeed_voltage(VFR_HUD, ratio=None): '''back-calculate the voltage the airspeed sensor must have seen''' import mavutil mav = mavutil.mavfile_global if ratio is None: ratio = 1.9936 # APM default if 'ARSPD_RATIO' in mav.params: used_ratio = mav.params['ARSPD_RATIO'] else: ...
[ "def", "airspeed_voltage", "(", "VFR_HUD", ",", "ratio", "=", "None", ")", ":", "import", "mavutil", "mav", "=", "mavutil", ".", "mavfile_global", "if", "ratio", "is", "None", ":", "ratio", "=", "1.9936", "# APM default", "if", "'ARSPD_RATIO'", "in", "mav", ...
back-calculate the voltage the airspeed sensor must have seen
[ "back", "-", "calculate", "the", "voltage", "the", "airspeed", "sensor", "must", "have", "seen" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L570-L588
235,411
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
earth_rates
def earth_rates(ATTITUDE): '''return angular velocities in earth frame''' from math import sin, cos, tan, fabs p = ATTITUDE.rollspeed q = ATTITUDE.pitchspeed r = ATTITUDE.yawspeed phi = ATTITUDE.roll theta = ATTITUDE.pitch psi = ATTITUDE.yaw phiDot = p + tan(theta...
python
def earth_rates(ATTITUDE): '''return angular velocities in earth frame''' from math import sin, cos, tan, fabs p = ATTITUDE.rollspeed q = ATTITUDE.pitchspeed r = ATTITUDE.yawspeed phi = ATTITUDE.roll theta = ATTITUDE.pitch psi = ATTITUDE.yaw phiDot = p + tan(theta...
[ "def", "earth_rates", "(", "ATTITUDE", ")", ":", "from", "math", "import", "sin", ",", "cos", ",", "tan", ",", "fabs", "p", "=", "ATTITUDE", ".", "rollspeed", "q", "=", "ATTITUDE", ".", "pitchspeed", "r", "=", "ATTITUDE", ".", "yawspeed", "phi", "=", ...
return angular velocities in earth frame
[ "return", "angular", "velocities", "in", "earth", "frame" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L591-L607
235,412
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
gps_velocity_body
def gps_velocity_body(GPS_RAW_INT, ATTITUDE): '''return GPS velocity vector in body frame''' r = rotation(ATTITUDE) return r.transposed() * Vector3(GPS_RAW_INT.vel*0.01*cos(radians(GPS_RAW_INT.cog*0.01)), GPS_RAW_INT.vel*0.01*sin(radians(GPS_RAW_INT.cog*0.01)), ...
python
def gps_velocity_body(GPS_RAW_INT, ATTITUDE): '''return GPS velocity vector in body frame''' r = rotation(ATTITUDE) return r.transposed() * Vector3(GPS_RAW_INT.vel*0.01*cos(radians(GPS_RAW_INT.cog*0.01)), GPS_RAW_INT.vel*0.01*sin(radians(GPS_RAW_INT.cog*0.01)), ...
[ "def", "gps_velocity_body", "(", "GPS_RAW_INT", ",", "ATTITUDE", ")", ":", "r", "=", "rotation", "(", "ATTITUDE", ")", "return", "r", ".", "transposed", "(", ")", "*", "Vector3", "(", "GPS_RAW_INT", ".", "vel", "*", "0.01", "*", "cos", "(", "radians", ...
return GPS velocity vector in body frame
[ "return", "GPS", "velocity", "vector", "in", "body", "frame" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L635-L640
235,413
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
earth_accel
def earth_accel(RAW_IMU,ATTITUDE): '''return earth frame acceleration vector''' r = rotation(ATTITUDE) accel = Vector3(RAW_IMU.xacc, RAW_IMU.yacc, RAW_IMU.zacc) * 9.81 * 0.001 return r * accel
python
def earth_accel(RAW_IMU,ATTITUDE): '''return earth frame acceleration vector''' r = rotation(ATTITUDE) accel = Vector3(RAW_IMU.xacc, RAW_IMU.yacc, RAW_IMU.zacc) * 9.81 * 0.001 return r * accel
[ "def", "earth_accel", "(", "RAW_IMU", ",", "ATTITUDE", ")", ":", "r", "=", "rotation", "(", "ATTITUDE", ")", "accel", "=", "Vector3", "(", "RAW_IMU", ".", "xacc", ",", "RAW_IMU", ".", "yacc", ",", "RAW_IMU", ".", "zacc", ")", "*", "9.81", "*", "0.001...
return earth frame acceleration vector
[ "return", "earth", "frame", "acceleration", "vector" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L642-L646
235,414
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
earth_gyro
def earth_gyro(RAW_IMU,ATTITUDE): '''return earth frame gyro vector''' r = rotation(ATTITUDE) accel = Vector3(degrees(RAW_IMU.xgyro), degrees(RAW_IMU.ygyro), degrees(RAW_IMU.zgyro)) * 0.001 return r * accel
python
def earth_gyro(RAW_IMU,ATTITUDE): '''return earth frame gyro vector''' r = rotation(ATTITUDE) accel = Vector3(degrees(RAW_IMU.xgyro), degrees(RAW_IMU.ygyro), degrees(RAW_IMU.zgyro)) * 0.001 return r * accel
[ "def", "earth_gyro", "(", "RAW_IMU", ",", "ATTITUDE", ")", ":", "r", "=", "rotation", "(", "ATTITUDE", ")", "accel", "=", "Vector3", "(", "degrees", "(", "RAW_IMU", ".", "xgyro", ")", ",", "degrees", "(", "RAW_IMU", ".", "ygyro", ")", ",", "degrees", ...
return earth frame gyro vector
[ "return", "earth", "frame", "gyro", "vector" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L648-L652
235,415
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
airspeed_energy_error
def airspeed_energy_error(NAV_CONTROLLER_OUTPUT, VFR_HUD): '''return airspeed energy error matching APM internals This is positive when we are going too slow ''' aspeed_cm = VFR_HUD.airspeed*100 target_airspeed = NAV_CONTROLLER_OUTPUT.aspd_error + aspeed_cm airspeed_energy_error = ((target_airsp...
python
def airspeed_energy_error(NAV_CONTROLLER_OUTPUT, VFR_HUD): '''return airspeed energy error matching APM internals This is positive when we are going too slow ''' aspeed_cm = VFR_HUD.airspeed*100 target_airspeed = NAV_CONTROLLER_OUTPUT.aspd_error + aspeed_cm airspeed_energy_error = ((target_airsp...
[ "def", "airspeed_energy_error", "(", "NAV_CONTROLLER_OUTPUT", ",", "VFR_HUD", ")", ":", "aspeed_cm", "=", "VFR_HUD", ".", "airspeed", "*", "100", "target_airspeed", "=", "NAV_CONTROLLER_OUTPUT", ".", "aspd_error", "+", "aspeed_cm", "airspeed_energy_error", "=", "(", ...
return airspeed energy error matching APM internals This is positive when we are going too slow
[ "return", "airspeed", "energy", "error", "matching", "APM", "internals", "This", "is", "positive", "when", "we", "are", "going", "too", "slow" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L654-L661
235,416
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
energy_error
def energy_error(NAV_CONTROLLER_OUTPUT, VFR_HUD): '''return energy error matching APM internals This is positive when we are too low or going too slow ''' aspeed_energy_error = airspeed_energy_error(NAV_CONTROLLER_OUTPUT, VFR_HUD) alt_error = NAV_CONTROLLER_OUTPUT.alt_error*100 energy_error = as...
python
def energy_error(NAV_CONTROLLER_OUTPUT, VFR_HUD): '''return energy error matching APM internals This is positive when we are too low or going too slow ''' aspeed_energy_error = airspeed_energy_error(NAV_CONTROLLER_OUTPUT, VFR_HUD) alt_error = NAV_CONTROLLER_OUTPUT.alt_error*100 energy_error = as...
[ "def", "energy_error", "(", "NAV_CONTROLLER_OUTPUT", ",", "VFR_HUD", ")", ":", "aspeed_energy_error", "=", "airspeed_energy_error", "(", "NAV_CONTROLLER_OUTPUT", ",", "VFR_HUD", ")", "alt_error", "=", "NAV_CONTROLLER_OUTPUT", ".", "alt_error", "*", "100", "energy_error"...
return energy error matching APM internals This is positive when we are too low or going too slow
[ "return", "energy", "error", "matching", "APM", "internals", "This", "is", "positive", "when", "we", "are", "too", "low", "or", "going", "too", "slow" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L664-L671
235,417
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
mixer
def mixer(servo1, servo2, mixtype=1, gain=0.5): '''mix two servos''' s1 = servo1 - 1500 s2 = servo2 - 1500 v1 = (s1-s2)*gain v2 = (s1+s2)*gain if mixtype == 2: v2 = -v2 elif mixtype == 3: v1 = -v1 elif mixtype == 4: v1 = -v1 v2 = -v2 if v1 > 600: ...
python
def mixer(servo1, servo2, mixtype=1, gain=0.5): '''mix two servos''' s1 = servo1 - 1500 s2 = servo2 - 1500 v1 = (s1-s2)*gain v2 = (s1+s2)*gain if mixtype == 2: v2 = -v2 elif mixtype == 3: v1 = -v1 elif mixtype == 4: v1 = -v1 v2 = -v2 if v1 > 600: ...
[ "def", "mixer", "(", "servo1", ",", "servo2", ",", "mixtype", "=", "1", ",", "gain", "=", "0.5", ")", ":", "s1", "=", "servo1", "-", "1500", "s2", "=", "servo2", "-", "1500", "v1", "=", "(", "s1", "-", "s2", ")", "*", "gain", "v2", "=", "(", ...
mix two servos
[ "mix", "two", "servos" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L724-L745
235,418
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
DCM_update
def DCM_update(IMU, ATT, MAG, GPS): '''implement full DCM system''' global dcm_state if dcm_state is None: dcm_state = DCM_State(ATT.Roll, ATT.Pitch, ATT.Yaw) mag = Vector3(MAG.MagX, MAG.MagY, MAG.MagZ) gyro = Vector3(IMU.GyrX, IMU.GyrY, IMU.GyrZ) accel = Vector3(IMU.AccX, IMU.AccY, ...
python
def DCM_update(IMU, ATT, MAG, GPS): '''implement full DCM system''' global dcm_state if dcm_state is None: dcm_state = DCM_State(ATT.Roll, ATT.Pitch, ATT.Yaw) mag = Vector3(MAG.MagX, MAG.MagY, MAG.MagZ) gyro = Vector3(IMU.GyrX, IMU.GyrY, IMU.GyrZ) accel = Vector3(IMU.AccX, IMU.AccY, ...
[ "def", "DCM_update", "(", "IMU", ",", "ATT", ",", "MAG", ",", "GPS", ")", ":", "global", "dcm_state", "if", "dcm_state", "is", "None", ":", "dcm_state", "=", "DCM_State", "(", "ATT", ".", "Roll", ",", "ATT", ".", "Pitch", ",", "ATT", ".", "Yaw", ")...
implement full DCM system
[ "implement", "full", "DCM", "system" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L818-L829
235,419
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
PX4_update
def PX4_update(IMU, ATT): '''implement full DCM using PX4 native SD log data''' global px4_state if px4_state is None: px4_state = PX4_State(degrees(ATT.Roll), degrees(ATT.Pitch), degrees(ATT.Yaw), IMU._timestamp) gyro = Vector3(IMU.GyroX, IMU.GyroY, IMU.GyroZ) accel = Vector3(IMU.AccX, IM...
python
def PX4_update(IMU, ATT): '''implement full DCM using PX4 native SD log data''' global px4_state if px4_state is None: px4_state = PX4_State(degrees(ATT.Roll), degrees(ATT.Pitch), degrees(ATT.Yaw), IMU._timestamp) gyro = Vector3(IMU.GyroX, IMU.GyroY, IMU.GyroZ) accel = Vector3(IMU.AccX, IM...
[ "def", "PX4_update", "(", "IMU", ",", "ATT", ")", ":", "global", "px4_state", "if", "px4_state", "is", "None", ":", "px4_state", "=", "PX4_State", "(", "degrees", "(", "ATT", ".", "Roll", ")", ",", "degrees", "(", "ATT", ".", "Pitch", ")", ",", "degr...
implement full DCM using PX4 native SD log data
[ "implement", "full", "DCM", "using", "PX4", "native", "SD", "log", "data" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L853-L862
235,420
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
armed
def armed(HEARTBEAT): '''return 1 if armed, 0 if not''' from . import mavutil if HEARTBEAT.type == mavutil.mavlink.MAV_TYPE_GCS: self = mavutil.mavfile_global if self.motors_armed(): return 1 return 0 if HEARTBEAT.base_mode & mavutil.mavlink.MAV_MODE_FLAG_SAFETY_ARMED...
python
def armed(HEARTBEAT): '''return 1 if armed, 0 if not''' from . import mavutil if HEARTBEAT.type == mavutil.mavlink.MAV_TYPE_GCS: self = mavutil.mavfile_global if self.motors_armed(): return 1 return 0 if HEARTBEAT.base_mode & mavutil.mavlink.MAV_MODE_FLAG_SAFETY_ARMED...
[ "def", "armed", "(", "HEARTBEAT", ")", ":", "from", ".", "import", "mavutil", "if", "HEARTBEAT", ".", "type", "==", "mavutil", ".", "mavlink", ".", "MAV_TYPE_GCS", ":", "self", "=", "mavutil", ".", "mavfile_global", "if", "self", ".", "motors_armed", "(", ...
return 1 if armed, 0 if not
[ "return", "1", "if", "armed", "0", "if", "not" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L872-L882
235,421
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
earth_accel2
def earth_accel2(RAW_IMU,ATTITUDE): '''return earth frame acceleration vector from AHRS2''' r = rotation2(ATTITUDE) accel = Vector3(RAW_IMU.xacc, RAW_IMU.yacc, RAW_IMU.zacc) * 9.81 * 0.001 return r * accel
python
def earth_accel2(RAW_IMU,ATTITUDE): '''return earth frame acceleration vector from AHRS2''' r = rotation2(ATTITUDE) accel = Vector3(RAW_IMU.xacc, RAW_IMU.yacc, RAW_IMU.zacc) * 9.81 * 0.001 return r * accel
[ "def", "earth_accel2", "(", "RAW_IMU", ",", "ATTITUDE", ")", ":", "r", "=", "rotation2", "(", "ATTITUDE", ")", "accel", "=", "Vector3", "(", "RAW_IMU", ".", "xacc", ",", "RAW_IMU", ".", "yacc", ",", "RAW_IMU", ".", "zacc", ")", "*", "9.81", "*", "0.0...
return earth frame acceleration vector from AHRS2
[ "return", "earth", "frame", "acceleration", "vector", "from", "AHRS2" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L896-L900
235,422
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
ekf1_pos
def ekf1_pos(EKF1): '''calculate EKF position when EKF disabled''' global ekf_home from . import mavutil self = mavutil.mavfile_global if ekf_home is None: if not 'GPS' in self.messages or self.messages['GPS'].Status != 3: return None ekf_home = self.messages['GPS'] (ekf_home.Lat, ...
python
def ekf1_pos(EKF1): '''calculate EKF position when EKF disabled''' global ekf_home from . import mavutil self = mavutil.mavfile_global if ekf_home is None: if not 'GPS' in self.messages or self.messages['GPS'].Status != 3: return None ekf_home = self.messages['GPS'] (ekf_home.Lat, ...
[ "def", "ekf1_pos", "(", "EKF1", ")", ":", "global", "ekf_home", "from", ".", "import", "mavutil", "self", "=", "mavutil", ".", "mavfile_global", "if", "ekf_home", "is", "None", ":", "if", "not", "'GPS'", "in", "self", ".", "messages", "or", "self", ".", ...
calculate EKF position when EKF disabled
[ "calculate", "EKF", "position", "when", "EKF", "disabled" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L964-L975
235,423
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_cmdlong.py
CmdlongModule.cmd_condition_yaw
def cmd_condition_yaw(self, args): '''yaw angle angular_speed angle_mode''' if ( len(args) != 3): print("Usage: yaw ANGLE ANGULAR_SPEED MODE:[0 absolute / 1 relative]") return if (len(args) == 3): angle = float(args[0]) angular_speed = float(args[...
python
def cmd_condition_yaw(self, args): '''yaw angle angular_speed angle_mode''' if ( len(args) != 3): print("Usage: yaw ANGLE ANGULAR_SPEED MODE:[0 absolute / 1 relative]") return if (len(args) == 3): angle = float(args[0]) angular_speed = float(args[...
[ "def", "cmd_condition_yaw", "(", "self", ",", "args", ")", ":", "if", "(", "len", "(", "args", ")", "!=", "3", ")", ":", "print", "(", "\"Usage: yaw ANGLE ANGULAR_SPEED MODE:[0 absolute / 1 relative]\"", ")", "return", "if", "(", "len", "(", "args", ")", "==...
yaw angle angular_speed angle_mode
[ "yaw", "angle", "angular_speed", "angle_mode" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_cmdlong.py#L126-L149
235,424
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_cmdlong.py
CmdlongModule.cmd_velocity
def cmd_velocity(self, args): '''velocity x-ms y-ms z-ms''' if (len(args) != 3): print("Usage: velocity x y z (m/s)") return if (len(args) == 3): x_mps = float(args[0]) y_mps = float(args[1]) z_mps = float(args[2]) #print("...
python
def cmd_velocity(self, args): '''velocity x-ms y-ms z-ms''' if (len(args) != 3): print("Usage: velocity x y z (m/s)") return if (len(args) == 3): x_mps = float(args[0]) y_mps = float(args[1]) z_mps = float(args[2]) #print("...
[ "def", "cmd_velocity", "(", "self", ",", "args", ")", ":", "if", "(", "len", "(", "args", ")", "!=", "3", ")", ":", "print", "(", "\"Usage: velocity x y z (m/s)\"", ")", "return", "if", "(", "len", "(", "args", ")", "==", "3", ")", ":", "x_mps", "=...
velocity x-ms y-ms z-ms
[ "velocity", "x", "-", "ms", "y", "-", "ms", "z", "-", "ms" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_cmdlong.py#L151-L171
235,425
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_cmdlong.py
CmdlongModule.cmd_position
def cmd_position(self, args): '''position x-m y-m z-m''' if (len(args) != 3): print("Usage: position x y z (meters)") return if (len(args) == 3): x_m = float(args[0]) y_m = float(args[1]) z_m = float(args[2]) print("x:%f, y...
python
def cmd_position(self, args): '''position x-m y-m z-m''' if (len(args) != 3): print("Usage: position x y z (meters)") return if (len(args) == 3): x_m = float(args[0]) y_m = float(args[1]) z_m = float(args[2]) print("x:%f, y...
[ "def", "cmd_position", "(", "self", ",", "args", ")", ":", "if", "(", "len", "(", "args", ")", "!=", "3", ")", ":", "print", "(", "\"Usage: position x y z (meters)\"", ")", "return", "if", "(", "len", "(", "args", ")", "==", "3", ")", ":", "x_m", "...
position x-m y-m z-m
[ "position", "x", "-", "m", "y", "-", "m", "z", "-", "m" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_cmdlong.py#L182-L202
235,426
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_cmdlong.py
CmdlongModule.cmd_attitude
def cmd_attitude(self, args): '''attitude q0 q1 q2 q3 thrust''' if len(args) != 5: print("Usage: attitude q0 q1 q2 q3 thrust (0~1)") return if len(args) == 5: q0 = float(args[0]) q1 = float(args[1]) q2 = float(args[2]) q3 =...
python
def cmd_attitude(self, args): '''attitude q0 q1 q2 q3 thrust''' if len(args) != 5: print("Usage: attitude q0 q1 q2 q3 thrust (0~1)") return if len(args) == 5: q0 = float(args[0]) q1 = float(args[1]) q2 = float(args[2]) q3 =...
[ "def", "cmd_attitude", "(", "self", ",", "args", ")", ":", "if", "len", "(", "args", ")", "!=", "5", ":", "print", "(", "\"Usage: attitude q0 q1 q2 q3 thrust (0~1)\"", ")", "return", "if", "len", "(", "args", ")", "==", "5", ":", "q0", "=", "float", "(...
attitude q0 q1 q2 q3 thrust
[ "attitude", "q0", "q1", "q2", "q3", "thrust" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_cmdlong.py#L204-L227
235,427
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_cmdlong.py
CmdlongModule.cmd_posvel
def cmd_posvel(self, args): '''posvel mapclick vN vE vD''' ignoremask = 511 latlon = None try: latlon = self.module('map').click_position except Exception: pass if latlon is None: print ("set latlon to zeros") latlon = [0, 0...
python
def cmd_posvel(self, args): '''posvel mapclick vN vE vD''' ignoremask = 511 latlon = None try: latlon = self.module('map').click_position except Exception: pass if latlon is None: print ("set latlon to zeros") latlon = [0, 0...
[ "def", "cmd_posvel", "(", "self", ",", "args", ")", ":", "ignoremask", "=", "511", "latlon", "=", "None", "try", ":", "latlon", "=", "self", ".", "module", "(", "'map'", ")", ".", "click_position", "except", "Exception", ":", "pass", "if", "latlon", "i...
posvel mapclick vN vE vD
[ "posvel", "mapclick", "vN", "vE", "vD" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_cmdlong.py#L229-L265
235,428
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_widgets.py
ImagePanel.on_paint
def on_paint(self, event): '''repaint the image''' dc = wx.AutoBufferedPaintDC(self) dc.DrawBitmap(self._bmp, 0, 0)
python
def on_paint(self, event): '''repaint the image''' dc = wx.AutoBufferedPaintDC(self) dc.DrawBitmap(self._bmp, 0, 0)
[ "def", "on_paint", "(", "self", ",", "event", ")", ":", "dc", "=", "wx", ".", "AutoBufferedPaintDC", "(", "self", ")", "dc", ".", "DrawBitmap", "(", "self", ".", "_bmp", ",", "0", ",", "0", ")" ]
repaint the image
[ "repaint", "the", "image" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_widgets.py#L19-L22
235,429
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen.py
mavgen_python_dialect
def mavgen_python_dialect(dialect, wire_protocol): '''generate the python code on the fly for a MAVLink dialect''' dialects = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'dialects') mdef = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'message_definitions') if...
python
def mavgen_python_dialect(dialect, wire_protocol): '''generate the python code on the fly for a MAVLink dialect''' dialects = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'dialects') mdef = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'message_definitions') if...
[ "def", "mavgen_python_dialect", "(", "dialect", ",", "wire_protocol", ")", ":", "dialects", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "__file__", ")", ")", ",", "'..'", ...
generate the python code on the fly for a MAVLink dialect
[ "generate", "the", "python", "code", "on", "the", "fly", "for", "a", "MAVLink", "dialect" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen.py#L165-L204
235,430
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/tools/mavtomfile.py
process_tlog
def process_tlog(filename): '''convert a tlog to a .m file''' print("Processing %s" % filename) mlog = mavutil.mavlink_connection(filename, dialect=args.dialect, zero_time_base=True) # first walk the entire file, grabbing all messages into a hash of lists, #and the first message of each type into...
python
def process_tlog(filename): '''convert a tlog to a .m file''' print("Processing %s" % filename) mlog = mavutil.mavlink_connection(filename, dialect=args.dialect, zero_time_base=True) # first walk the entire file, grabbing all messages into a hash of lists, #and the first message of each type into...
[ "def", "process_tlog", "(", "filename", ")", ":", "print", "(", "\"Processing %s\"", "%", "filename", ")", "mlog", "=", "mavutil", ".", "mavlink_connection", "(", "filename", ",", "dialect", "=", "args", ".", "dialect", ",", "zero_time_base", "=", "True", ")...
convert a tlog to a .m file
[ "convert", "a", "tlog", "to", "a", ".", "m", "file" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/tools/mavtomfile.py#L11-L82
235,431
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/tools/magfit_motors.py
radius
def radius(d, offsets, motor_ofs): '''return radius give data point and offsets''' (mag, motor) = d return (mag + offsets + motor*motor_ofs).length()
python
def radius(d, offsets, motor_ofs): '''return radius give data point and offsets''' (mag, motor) = d return (mag + offsets + motor*motor_ofs).length()
[ "def", "radius", "(", "d", ",", "offsets", ",", "motor_ofs", ")", ":", "(", "mag", ",", "motor", ")", "=", "d", "return", "(", "mag", "+", "offsets", "+", "motor", "*", "motor_ofs", ")", ".", "length", "(", ")" ]
return radius give data point and offsets
[ "return", "radius", "give", "data", "point", "and", "offsets" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/tools/magfit_motors.py#L44-L47
235,432
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_objc.py
camel_case_from_underscores
def camel_case_from_underscores(string): """generate a CamelCase string from an underscore_string.""" components = string.split('_') string = '' for component in components: string += component[0].upper() + component[1:] return string
python
def camel_case_from_underscores(string): """generate a CamelCase string from an underscore_string.""" components = string.split('_') string = '' for component in components: string += component[0].upper() + component[1:] return string
[ "def", "camel_case_from_underscores", "(", "string", ")", ":", "components", "=", "string", ".", "split", "(", "'_'", ")", "string", "=", "''", "for", "component", "in", "components", ":", "string", "+=", "component", "[", "0", "]", ".", "upper", "(", ")...
generate a CamelCase string from an underscore_string.
[ "generate", "a", "CamelCase", "string", "from", "an", "underscore_string", "." ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_objc.py#L311-L317
235,433
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_objc.py
generate
def generate(basename, xml_list): '''generate complete MAVLink Objective-C implemenation''' generate_shared(basename, xml_list) for xml in xml_list: generate_message_definitions(basename, xml)
python
def generate(basename, xml_list): '''generate complete MAVLink Objective-C implemenation''' generate_shared(basename, xml_list) for xml in xml_list: generate_message_definitions(basename, xml)
[ "def", "generate", "(", "basename", ",", "xml_list", ")", ":", "generate_shared", "(", "basename", ",", "xml_list", ")", "for", "xml", "in", "xml_list", ":", "generate_message_definitions", "(", "basename", ",", "xml", ")" ]
generate complete MAVLink Objective-C implemenation
[ "generate", "complete", "MAVLink", "Objective", "-", "C", "implemenation" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_objc.py#L431-L436
235,434
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/lib/live_graph.py
LiveGraph.add_values
def add_values(self, values): '''add some data to the graph''' if self.child.is_alive(): self.parent_pipe.send(values)
python
def add_values(self, values): '''add some data to the graph''' if self.child.is_alive(): self.parent_pipe.send(values)
[ "def", "add_values", "(", "self", ",", "values", ")", ":", "if", "self", ".", "child", ".", "is_alive", "(", ")", ":", "self", ".", "parent_pipe", ".", "send", "(", "values", ")" ]
add some data to the graph
[ "add", "some", "data", "to", "the", "graph" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/lib/live_graph.py#L57-L60
235,435
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/lib/live_graph.py
LiveGraph.close
def close(self): '''close the graph''' self.close_graph.set() if self.is_alive(): self.child.join(2)
python
def close(self): '''close the graph''' self.close_graph.set() if self.is_alive(): self.child.join(2)
[ "def", "close", "(", "self", ")", ":", "self", ".", "close_graph", ".", "set", "(", ")", "if", "self", ".", "is_alive", "(", ")", ":", "self", ".", "child", ".", "join", "(", "2", ")" ]
close the graph
[ "close", "the", "graph" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/lib/live_graph.py#L62-L66
235,436
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_swift.py
get_enum_raw_type
def get_enum_raw_type(enum, msgs): """Search appropirate raw type for enums in messages fields""" for msg in msgs: for field in msg.fields: if field.enum == enum.name: return swift_types[field.type][0] return "Int"
python
def get_enum_raw_type(enum, msgs): """Search appropirate raw type for enums in messages fields""" for msg in msgs: for field in msg.fields: if field.enum == enum.name: return swift_types[field.type][0] return "Int"
[ "def", "get_enum_raw_type", "(", "enum", ",", "msgs", ")", ":", "for", "msg", "in", "msgs", ":", "for", "field", "in", "msg", ".", "fields", ":", "if", "field", ".", "enum", "==", "enum", ".", "name", ":", "return", "swift_types", "[", "field", ".", ...
Search appropirate raw type for enums in messages fields
[ "Search", "appropirate", "raw", "type", "for", "enums", "in", "messages", "fields" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_swift.py#L139-L146
235,437
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_swift.py
append_static_code
def append_static_code(filename, outf): """Open and copy static code from specified file""" basepath = os.path.dirname(os.path.realpath(__file__)) filepath = os.path.join(basepath, 'swift/%s' % filename) print("Appending content of %s" % filename) with open(filepath) as inf: for l...
python
def append_static_code(filename, outf): """Open and copy static code from specified file""" basepath = os.path.dirname(os.path.realpath(__file__)) filepath = os.path.join(basepath, 'swift/%s' % filename) print("Appending content of %s" % filename) with open(filepath) as inf: for l...
[ "def", "append_static_code", "(", "filename", ",", "outf", ")", ":", "basepath", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "__file__", ")", ")", "filepath", "=", "os", ".", "path", ".", "join", "(", "basepa...
Open and copy static code from specified file
[ "Open", "and", "copy", "static", "code", "from", "specified", "file" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_swift.py#L243-L253
235,438
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_swift.py
camel_case_from_underscores
def camel_case_from_underscores(string): """Generate a CamelCase string from an underscore_string""" components = string.split('_') string = '' for component in components: if component in abbreviations: string += component else: string += component[0].upper() +...
python
def camel_case_from_underscores(string): """Generate a CamelCase string from an underscore_string""" components = string.split('_') string = '' for component in components: if component in abbreviations: string += component else: string += component[0].upper() +...
[ "def", "camel_case_from_underscores", "(", "string", ")", ":", "components", "=", "string", ".", "split", "(", "'_'", ")", "string", "=", "''", "for", "component", "in", "components", ":", "if", "component", "in", "abbreviations", ":", "string", "+=", "compo...
Generate a CamelCase string from an underscore_string
[ "Generate", "a", "CamelCase", "string", "from", "an", "underscore_string" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_swift.py#L304-L316
235,439
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_swift.py
generate_enums_info
def generate_enums_info(enums, msgs): """Add camel case swift names for enums an entries, descriptions and sort enums alphabetically""" for enum in enums: enum.swift_name = camel_case_from_underscores(enum.name) enum.raw_value_type = get_enum_raw_type(enum, msgs) enum.formatted_descrip...
python
def generate_enums_info(enums, msgs): """Add camel case swift names for enums an entries, descriptions and sort enums alphabetically""" for enum in enums: enum.swift_name = camel_case_from_underscores(enum.name) enum.raw_value_type = get_enum_raw_type(enum, msgs) enum.formatted_descrip...
[ "def", "generate_enums_info", "(", "enums", ",", "msgs", ")", ":", "for", "enum", "in", "enums", ":", "enum", ".", "swift_name", "=", "camel_case_from_underscores", "(", "enum", ".", "name", ")", "enum", ".", "raw_value_type", "=", "get_enum_raw_type", "(", ...
Add camel case swift names for enums an entries, descriptions and sort enums alphabetically
[ "Add", "camel", "case", "swift", "names", "for", "enums", "an", "entries", "descriptions", "and", "sort", "enums", "alphabetically" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_swift.py#L328-L362
235,440
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_swift.py
generate_messages_info
def generate_messages_info(msgs): """Add proper formated variable names, initializers and type names to use in templates""" for msg in msgs: msg.swift_name = camel_case_from_underscores(msg.name) msg.formatted_description = "" if msg.description: msg.description = " ".join(...
python
def generate_messages_info(msgs): """Add proper formated variable names, initializers and type names to use in templates""" for msg in msgs: msg.swift_name = camel_case_from_underscores(msg.name) msg.formatted_description = "" if msg.description: msg.description = " ".join(...
[ "def", "generate_messages_info", "(", "msgs", ")", ":", "for", "msg", "in", "msgs", ":", "msg", ".", "swift_name", "=", "camel_case_from_underscores", "(", "msg", ".", "name", ")", "msg", ".", "formatted_description", "=", "\"\"", "if", "msg", ".", "descript...
Add proper formated variable names, initializers and type names to use in templates
[ "Add", "proper", "formated", "variable", "names", "initializers", "and", "type", "names", "to", "use", "in", "templates" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_swift.py#L364-L405
235,441
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_swift.py
generate
def generate(basename, xml_list): """Generate complete MAVLink Swift implemenation""" if os.path.isdir(basename): filename = os.path.join(basename, 'MAVLink.swift') else: filename = basename msgs = [] enums = [] filelist = [] for xml in xml_list: msgs.extend(xml.mes...
python
def generate(basename, xml_list): """Generate complete MAVLink Swift implemenation""" if os.path.isdir(basename): filename = os.path.join(basename, 'MAVLink.swift') else: filename = basename msgs = [] enums = [] filelist = [] for xml in xml_list: msgs.extend(xml.mes...
[ "def", "generate", "(", "basename", ",", "xml_list", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "basename", ")", ":", "filename", "=", "os", ".", "path", ".", "join", "(", "basename", ",", "'MAVLink.swift'", ")", "else", ":", "filename", "...
Generate complete MAVLink Swift implemenation
[ "Generate", "complete", "MAVLink", "Swift", "implemenation" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_swift.py#L407-L433
235,442
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py
MAVWPLoader.wp_is_loiter
def wp_is_loiter(self, i): '''return true if waypoint is a loiter waypoint''' loiter_cmds = [mavutil.mavlink.MAV_CMD_NAV_LOITER_UNLIM, mavutil.mavlink.MAV_CMD_NAV_LOITER_TURNS, mavutil.mavlink.MAV_CMD_NAV_LOITER_TIME, mavutil.mavlink.MAV_CMD_NAV_LOITER_TO_...
python
def wp_is_loiter(self, i): '''return true if waypoint is a loiter waypoint''' loiter_cmds = [mavutil.mavlink.MAV_CMD_NAV_LOITER_UNLIM, mavutil.mavlink.MAV_CMD_NAV_LOITER_TURNS, mavutil.mavlink.MAV_CMD_NAV_LOITER_TIME, mavutil.mavlink.MAV_CMD_NAV_LOITER_TO_...
[ "def", "wp_is_loiter", "(", "self", ",", "i", ")", ":", "loiter_cmds", "=", "[", "mavutil", ".", "mavlink", ".", "MAV_CMD_NAV_LOITER_UNLIM", ",", "mavutil", ".", "mavlink", ".", "MAV_CMD_NAV_LOITER_TURNS", ",", "mavutil", ".", "mavlink", ".", "MAV_CMD_NAV_LOITER...
return true if waypoint is a loiter waypoint
[ "return", "true", "if", "waypoint", "is", "a", "loiter", "waypoint" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py#L44-L54
235,443
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py
MAVWPLoader.add
def add(self, w, comment=''): '''add a waypoint''' w = copy.copy(w) if comment: w.comment = comment w.seq = self.count() self.wpoints.append(w) self.last_change = time.time()
python
def add(self, w, comment=''): '''add a waypoint''' w = copy.copy(w) if comment: w.comment = comment w.seq = self.count() self.wpoints.append(w) self.last_change = time.time()
[ "def", "add", "(", "self", ",", "w", ",", "comment", "=", "''", ")", ":", "w", "=", "copy", ".", "copy", "(", "w", ")", "if", "comment", ":", "w", ".", "comment", "=", "comment", "w", ".", "seq", "=", "self", ".", "count", "(", ")", "self", ...
add a waypoint
[ "add", "a", "waypoint" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py#L56-L63
235,444
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py
MAVWPLoader.insert
def insert(self, idx, w, comment=''): '''insert a waypoint''' if idx >= self.count(): self.add(w, comment) return if idx < 0: return w = copy.copy(w) if comment: w.comment = comment w.seq = idx self.wpoints.insert(id...
python
def insert(self, idx, w, comment=''): '''insert a waypoint''' if idx >= self.count(): self.add(w, comment) return if idx < 0: return w = copy.copy(w) if comment: w.comment = comment w.seq = idx self.wpoints.insert(id...
[ "def", "insert", "(", "self", ",", "idx", ",", "w", ",", "comment", "=", "''", ")", ":", "if", "idx", ">=", "self", ".", "count", "(", ")", ":", "self", ".", "add", "(", "w", ",", "comment", ")", "return", "if", "idx", "<", "0", ":", "return"...
insert a waypoint
[ "insert", "a", "waypoint" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py#L65-L78
235,445
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py
MAVWPLoader.set
def set(self, w, idx): '''set a waypoint''' w.seq = idx if w.seq == self.count(): return self.add(w) if self.count() <= idx: raise MAVWPError('adding waypoint at idx=%u past end of list (count=%u)' % (idx, self.count())) self.wpoints[idx] = w self....
python
def set(self, w, idx): '''set a waypoint''' w.seq = idx if w.seq == self.count(): return self.add(w) if self.count() <= idx: raise MAVWPError('adding waypoint at idx=%u past end of list (count=%u)' % (idx, self.count())) self.wpoints[idx] = w self....
[ "def", "set", "(", "self", ",", "w", ",", "idx", ")", ":", "w", ".", "seq", "=", "idx", "if", "w", ".", "seq", "==", "self", ".", "count", "(", ")", ":", "return", "self", ".", "add", "(", "w", ")", "if", "self", ".", "count", "(", ")", "...
set a waypoint
[ "set", "a", "waypoint" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py#L102-L110
235,446
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py
MAVWPLoader.remove
def remove(self, w): '''remove a waypoint''' self.wpoints.remove(w) self.last_change = time.time() self.reindex()
python
def remove(self, w): '''remove a waypoint''' self.wpoints.remove(w) self.last_change = time.time() self.reindex()
[ "def", "remove", "(", "self", ",", "w", ")", ":", "self", ".", "wpoints", ".", "remove", "(", "w", ")", "self", ".", "last_change", "=", "time", ".", "time", "(", ")", "self", ".", "reindex", "(", ")" ]
remove a waypoint
[ "remove", "a", "waypoint" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py#L112-L116
235,447
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py
MAVWPLoader._read_waypoints_v100
def _read_waypoints_v100(self, file): '''read a version 100 waypoint''' cmdmap = { 2 : mavutil.mavlink.MAV_CMD_NAV_TAKEOFF, 3 : mavutil.mavlink.MAV_CMD_NAV_RETURN_TO_LAUNCH, 4 : mavutil.mavlink.MAV_CMD_NAV_LAND, 24: mavutil.mavlink.MAV_CMD_NAV_TAKEOFF, ...
python
def _read_waypoints_v100(self, file): '''read a version 100 waypoint''' cmdmap = { 2 : mavutil.mavlink.MAV_CMD_NAV_TAKEOFF, 3 : mavutil.mavlink.MAV_CMD_NAV_RETURN_TO_LAUNCH, 4 : mavutil.mavlink.MAV_CMD_NAV_LAND, 24: mavutil.mavlink.MAV_CMD_NAV_TAKEOFF, ...
[ "def", "_read_waypoints_v100", "(", "self", ",", "file", ")", ":", "cmdmap", "=", "{", "2", ":", "mavutil", ".", "mavlink", ".", "MAV_CMD_NAV_TAKEOFF", ",", "3", ":", "mavutil", ".", "mavlink", ".", "MAV_CMD_NAV_RETURN_TO_LAUNCH", ",", "4", ":", "mavutil", ...
read a version 100 waypoint
[ "read", "a", "version", "100", "waypoint" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py#L123-L168
235,448
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py
MAVWPLoader._read_waypoints_v110
def _read_waypoints_v110(self, file): '''read a version 110 waypoint''' comment = '' for line in file: if line.startswith('#'): comment = line[1:].lstrip() continue line = line.strip() if not line: continue ...
python
def _read_waypoints_v110(self, file): '''read a version 110 waypoint''' comment = '' for line in file: if line.startswith('#'): comment = line[1:].lstrip() continue line = line.strip() if not line: continue ...
[ "def", "_read_waypoints_v110", "(", "self", ",", "file", ")", ":", "comment", "=", "''", "for", "line", "in", "file", ":", "if", "line", ".", "startswith", "(", "'#'", ")", ":", "comment", "=", "line", "[", "1", ":", "]", ".", "lstrip", "(", ")", ...
read a version 110 waypoint
[ "read", "a", "version", "110", "waypoint" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py#L170-L205
235,449
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py
MAVWPLoader.load
def load(self, filename): '''load waypoints from a file. returns number of waypoints loaded''' f = open(filename, mode='r') version_line = f.readline().strip() if version_line == "QGC WPL 100": readfn = self._read_waypoints_v100 elif version_line == "QGC WPL 1...
python
def load(self, filename): '''load waypoints from a file. returns number of waypoints loaded''' f = open(filename, mode='r') version_line = f.readline().strip() if version_line == "QGC WPL 100": readfn = self._read_waypoints_v100 elif version_line == "QGC WPL 1...
[ "def", "load", "(", "self", ",", "filename", ")", ":", "f", "=", "open", "(", "filename", ",", "mode", "=", "'r'", ")", "version_line", "=", "f", ".", "readline", "(", ")", ".", "strip", "(", ")", "if", "version_line", "==", "\"QGC WPL 100\"", ":", ...
load waypoints from a file. returns number of waypoints loaded
[ "load", "waypoints", "from", "a", "file", ".", "returns", "number", "of", "waypoints", "loaded" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py#L263-L282
235,450
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py
MAVWPLoader.view_indexes
def view_indexes(self, done=None): '''return a list waypoint indexes in view order''' ret = [] if done is None: done = set() idx = 0 # find first point not done yet while idx < self.count(): if not idx in done: break id...
python
def view_indexes(self, done=None): '''return a list waypoint indexes in view order''' ret = [] if done is None: done = set() idx = 0 # find first point not done yet while idx < self.count(): if not idx in done: break id...
[ "def", "view_indexes", "(", "self", ",", "done", "=", "None", ")", ":", "ret", "=", "[", "]", "if", "done", "is", "None", ":", "done", "=", "set", "(", ")", "idx", "=", "0", "# find first point not done yet", "while", "idx", "<", "self", ".", "count"...
return a list waypoint indexes in view order
[ "return", "a", "list", "waypoint", "indexes", "in", "view", "order" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py#L330-L359
235,451
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py
MAVWPLoader.polygon
def polygon(self, done=None): '''return a polygon for the waypoints''' indexes = self.view_indexes(done) points = [] for idx in indexes: w = self.wp(idx) points.append((w.x, w.y)) return points
python
def polygon(self, done=None): '''return a polygon for the waypoints''' indexes = self.view_indexes(done) points = [] for idx in indexes: w = self.wp(idx) points.append((w.x, w.y)) return points
[ "def", "polygon", "(", "self", ",", "done", "=", "None", ")", ":", "indexes", "=", "self", ".", "view_indexes", "(", "done", ")", "points", "=", "[", "]", "for", "idx", "in", "indexes", ":", "w", "=", "self", ".", "wp", "(", "idx", ")", "points",...
return a polygon for the waypoints
[ "return", "a", "polygon", "for", "the", "waypoints" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py#L361-L368
235,452
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py
MAVWPLoader.polygon_list
def polygon_list(self): '''return a list of polygons for the waypoints''' done = set() ret = [] while len(done) != self.count(): p = self.polygon(done) if len(p) > 0: ret.append(p) return ret
python
def polygon_list(self): '''return a list of polygons for the waypoints''' done = set() ret = [] while len(done) != self.count(): p = self.polygon(done) if len(p) > 0: ret.append(p) return ret
[ "def", "polygon_list", "(", "self", ")", ":", "done", "=", "set", "(", ")", "ret", "=", "[", "]", "while", "len", "(", "done", ")", "!=", "self", ".", "count", "(", ")", ":", "p", "=", "self", ".", "polygon", "(", "done", ")", "if", "len", "(...
return a list of polygons for the waypoints
[ "return", "a", "list", "of", "polygons", "for", "the", "waypoints" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py#L370-L378
235,453
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py
MAVWPLoader.view_list
def view_list(self): '''return a list of polygon indexes lists for the waypoints''' done = set() ret = [] while len(done) != self.count(): p = self.view_indexes(done) if len(p) > 0: ret.append(p) return ret
python
def view_list(self): '''return a list of polygon indexes lists for the waypoints''' done = set() ret = [] while len(done) != self.count(): p = self.view_indexes(done) if len(p) > 0: ret.append(p) return ret
[ "def", "view_list", "(", "self", ")", ":", "done", "=", "set", "(", ")", "ret", "=", "[", "]", "while", "len", "(", "done", ")", "!=", "self", ".", "count", "(", ")", ":", "p", "=", "self", ".", "view_indexes", "(", "done", ")", "if", "len", ...
return a list of polygon indexes lists for the waypoints
[ "return", "a", "list", "of", "polygon", "indexes", "lists", "for", "the", "waypoints" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py#L380-L388
235,454
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py
MAVRallyLoader.reindex
def reindex(self): '''reset counters and indexes''' for i in range(self.rally_count()): self.rally_points[i].count = self.rally_count() self.rally_points[i].idx = i self.last_change = time.time()
python
def reindex(self): '''reset counters and indexes''' for i in range(self.rally_count()): self.rally_points[i].count = self.rally_count() self.rally_points[i].idx = i self.last_change = time.time()
[ "def", "reindex", "(", "self", ")", ":", "for", "i", "in", "range", "(", "self", ".", "rally_count", "(", ")", ")", ":", "self", ".", "rally_points", "[", "i", "]", ".", "count", "=", "self", ".", "rally_count", "(", ")", "self", ".", "rally_points...
reset counters and indexes
[ "reset", "counters", "and", "indexes" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py#L412-L417
235,455
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py
MAVRallyLoader.append_rally_point
def append_rally_point(self, p): '''add rallypoint to end of list''' if (self.rally_count() > 9): print("Can't have more than 10 rally points, not adding.") return self.rally_points.append(p) self.reindex()
python
def append_rally_point(self, p): '''add rallypoint to end of list''' if (self.rally_count() > 9): print("Can't have more than 10 rally points, not adding.") return self.rally_points.append(p) self.reindex()
[ "def", "append_rally_point", "(", "self", ",", "p", ")", ":", "if", "(", "self", ".", "rally_count", "(", ")", ">", "9", ")", ":", "print", "(", "\"Can't have more than 10 rally points, not adding.\"", ")", "return", "self", ".", "rally_points", ".", "append",...
add rallypoint to end of list
[ "add", "rallypoint", "to", "end", "of", "list" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py#L419-L426
235,456
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py
MAVRallyLoader.load
def load(self, filename): '''load rally and rally_land points from a file. returns number of points loaded''' f = open(filename, mode='r') self.clear() for line in f: if line.startswith('#'): continue line = line.strip() if not...
python
def load(self, filename): '''load rally and rally_land points from a file. returns number of points loaded''' f = open(filename, mode='r') self.clear() for line in f: if line.startswith('#'): continue line = line.strip() if not...
[ "def", "load", "(", "self", ",", "filename", ")", ":", "f", "=", "open", "(", "filename", ",", "mode", "=", "'r'", ")", "self", ".", "clear", "(", ")", "for", "line", "in", "f", ":", "if", "line", ".", "startswith", "(", "'#'", ")", ":", "conti...
load rally and rally_land points from a file. returns number of points loaded
[ "load", "rally", "and", "rally_land", "points", "from", "a", "file", ".", "returns", "number", "of", "points", "loaded" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py#L466-L485
235,457
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py
MAVFenceLoader.load
def load(self, filename): '''load points from a file. returns number of points loaded''' f = open(filename, mode='r') self.clear() for line in f: if line.startswith('#'): continue line = line.strip() if not line: ...
python
def load(self, filename): '''load points from a file. returns number of points loaded''' f = open(filename, mode='r') self.clear() for line in f: if line.startswith('#'): continue line = line.strip() if not line: ...
[ "def", "load", "(", "self", ",", "filename", ")", ":", "f", "=", "open", "(", "filename", ",", "mode", "=", "'r'", ")", "self", ".", "clear", "(", ")", "for", "line", "in", "f", ":", "if", "line", ".", "startswith", "(", "'#'", ")", ":", "conti...
load points from a file. returns number of points loaded
[ "load", "points", "from", "a", "file", ".", "returns", "number", "of", "points", "loaded" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py#L543-L559
235,458
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py
MAVFenceLoader.move
def move(self, i, lat, lng, change_time=True): '''move a fence point''' if i < 0 or i >= self.count(): print("Invalid fence point number %u" % i) self.points[i].lat = lat self.points[i].lng = lng # ensure we close the polygon if i == 1: self.po...
python
def move(self, i, lat, lng, change_time=True): '''move a fence point''' if i < 0 or i >= self.count(): print("Invalid fence point number %u" % i) self.points[i].lat = lat self.points[i].lng = lng # ensure we close the polygon if i == 1: self.po...
[ "def", "move", "(", "self", ",", "i", ",", "lat", ",", "lng", ",", "change_time", "=", "True", ")", ":", "if", "i", "<", "0", "or", "i", ">=", "self", ".", "count", "(", ")", ":", "print", "(", "\"Invalid fence point number %u\"", "%", "i", ")", ...
move a fence point
[ "move", "a", "fence", "point" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py#L568-L582
235,459
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py
MAVFenceLoader.remove
def remove(self, i, change_time=True): '''remove a fence point''' if i < 0 or i >= self.count(): print("Invalid fence point number %u" % i) self.points.pop(i) # ensure we close the polygon if i == 1: self.points[self.count()-1].lat = self.points[1].la...
python
def remove(self, i, change_time=True): '''remove a fence point''' if i < 0 or i >= self.count(): print("Invalid fence point number %u" % i) self.points.pop(i) # ensure we close the polygon if i == 1: self.points[self.count()-1].lat = self.points[1].la...
[ "def", "remove", "(", "self", ",", "i", ",", "change_time", "=", "True", ")", ":", "if", "i", "<", "0", "or", "i", ">=", "self", ".", "count", "(", ")", ":", "print", "(", "\"Invalid fence point number %u\"", "%", "i", ")", "self", ".", "points", "...
remove a fence point
[ "remove", "a", "fence", "point" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py#L584-L597
235,460
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py
MAVFenceLoader.polygon
def polygon(self): '''return a polygon for the fence''' points = [] for fp in self.points[1:]: points.append((fp.lat, fp.lng)) return points
python
def polygon(self): '''return a polygon for the fence''' points = [] for fp in self.points[1:]: points.append((fp.lat, fp.lng)) return points
[ "def", "polygon", "(", "self", ")", ":", "points", "=", "[", "]", "for", "fp", "in", "self", ".", "points", "[", "1", ":", "]", ":", "points", ".", "append", "(", "(", "fp", ".", "lat", ",", "fp", ".", "lng", ")", ")", "return", "points" ]
return a polygon for the fence
[ "return", "a", "polygon", "for", "the", "fence" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py#L599-L604
235,461
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/mavproxy.py
add_input
def add_input(cmd, immediate=False): '''add some command input to be processed''' if immediate: process_stdin(cmd) else: mpstate.input_queue.put(cmd)
python
def add_input(cmd, immediate=False): '''add some command input to be processed''' if immediate: process_stdin(cmd) else: mpstate.input_queue.put(cmd)
[ "def", "add_input", "(", "cmd", ",", "immediate", "=", "False", ")", ":", "if", "immediate", ":", "process_stdin", "(", "cmd", ")", "else", ":", "mpstate", ".", "input_queue", ".", "put", "(", "cmd", ")" ]
add some command input to be processed
[ "add", "some", "command", "input", "to", "be", "processed" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/mavproxy.py#L122-L127
235,462
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/mavproxy.py
param_set
def param_set(name, value, retries=3): '''set a parameter''' name = name.upper() return mpstate.mav_param.mavset(mpstate.master(), name, value, retries=retries)
python
def param_set(name, value, retries=3): '''set a parameter''' name = name.upper() return mpstate.mav_param.mavset(mpstate.master(), name, value, retries=retries)
[ "def", "param_set", "(", "name", ",", "value", ",", "retries", "=", "3", ")", ":", "name", "=", "name", ".", "upper", "(", ")", "return", "mpstate", ".", "mav_param", ".", "mavset", "(", "mpstate", ".", "master", "(", ")", ",", "name", ",", "value"...
set a parameter
[ "set", "a", "parameter" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/mavproxy.py#L242-L245
235,463
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/mavproxy.py
unload_module
def unload_module(modname): '''unload a module''' for (m,pm) in mpstate.modules: if m.name == modname: if hasattr(m, 'unload'): m.unload() mpstate.modules.remove((m,pm)) print("Unloaded module %s" % modname) return True print("Unable to...
python
def unload_module(modname): '''unload a module''' for (m,pm) in mpstate.modules: if m.name == modname: if hasattr(m, 'unload'): m.unload() mpstate.modules.remove((m,pm)) print("Unloaded module %s" % modname) return True print("Unable to...
[ "def", "unload_module", "(", "modname", ")", ":", "for", "(", "m", ",", "pm", ")", "in", "mpstate", ".", "modules", ":", "if", "m", ".", "name", "==", "modname", ":", "if", "hasattr", "(", "m", ",", "'unload'", ")", ":", "m", ".", "unload", "(", ...
unload a module
[ "unload", "a", "module" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/mavproxy.py#L313-L323
235,464
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/mavproxy.py
import_package
def import_package(name): """Given a package name like 'foo.bar.quux', imports the package and returns the desired module.""" import zipimport try: mod = __import__(name) except ImportError: clear_zipimport_cache() mod = __import__(name) components = name.split('.') ...
python
def import_package(name): """Given a package name like 'foo.bar.quux', imports the package and returns the desired module.""" import zipimport try: mod = __import__(name) except ImportError: clear_zipimport_cache() mod = __import__(name) components = name.split('.') ...
[ "def", "import_package", "(", "name", ")", ":", "import", "zipimport", "try", ":", "mod", "=", "__import__", "(", "name", ")", "except", "ImportError", ":", "clear_zipimport_cache", "(", ")", "mod", "=", "__import__", "(", "name", ")", "components", "=", "...
Given a package name like 'foo.bar.quux', imports the package and returns the desired module.
[ "Given", "a", "package", "name", "like", "foo", ".", "bar", ".", "quux", "imports", "the", "package", "and", "returns", "the", "desired", "module", "." ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/mavproxy.py#L416-L429
235,465
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/mavproxy.py
process_master
def process_master(m): '''process packets from the MAVLink master''' try: s = m.recv(16*1024) except Exception: time.sleep(0.1) return # prevent a dead serial port from causing the CPU to spin. The user hitting enter will # cause it to try and reconnect if len(s) == 0: ...
python
def process_master(m): '''process packets from the MAVLink master''' try: s = m.recv(16*1024) except Exception: time.sleep(0.1) return # prevent a dead serial port from causing the CPU to spin. The user hitting enter will # cause it to try and reconnect if len(s) == 0: ...
[ "def", "process_master", "(", "m", ")", ":", "try", ":", "s", "=", "m", ".", "recv", "(", "16", "*", "1024", ")", "except", "Exception", ":", "time", ".", "sleep", "(", "0.1", ")", "return", "# prevent a dead serial port from causing the CPU to spin. The user ...
process packets from the MAVLink master
[ "process", "packets", "from", "the", "MAVLink", "master" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/mavproxy.py#L518-L559
235,466
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/mavproxy.py
set_stream_rates
def set_stream_rates(): '''set mavlink stream rates''' if (not msg_period.trigger() and mpstate.status.last_streamrate1 == mpstate.settings.streamrate and mpstate.status.last_streamrate2 == mpstate.settings.streamrate2): return mpstate.status.last_streamrate1 = mpstate.settings.strea...
python
def set_stream_rates(): '''set mavlink stream rates''' if (not msg_period.trigger() and mpstate.status.last_streamrate1 == mpstate.settings.streamrate and mpstate.status.last_streamrate2 == mpstate.settings.streamrate2): return mpstate.status.last_streamrate1 = mpstate.settings.strea...
[ "def", "set_stream_rates", "(", ")", ":", "if", "(", "not", "msg_period", ".", "trigger", "(", ")", "and", "mpstate", ".", "status", ".", "last_streamrate1", "==", "mpstate", ".", "settings", ".", "streamrate", "and", "mpstate", ".", "status", ".", "last_s...
set mavlink stream rates
[ "set", "mavlink", "stream", "rates" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/mavproxy.py#L669-L685
235,467
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/mavproxy.py
periodic_tasks
def periodic_tasks(): '''run periodic checks''' if mpstate.status.setup_mode: return if (mpstate.settings.compdebug & 2) != 0: return if mpstate.settings.heartbeat != 0: heartbeat_period.frequency = mpstate.settings.heartbeat if heartbeat_period.trigger() and mpstate.setti...
python
def periodic_tasks(): '''run periodic checks''' if mpstate.status.setup_mode: return if (mpstate.settings.compdebug & 2) != 0: return if mpstate.settings.heartbeat != 0: heartbeat_period.frequency = mpstate.settings.heartbeat if heartbeat_period.trigger() and mpstate.setti...
[ "def", "periodic_tasks", "(", ")", ":", "if", "mpstate", ".", "status", ".", "setup_mode", ":", "return", "if", "(", "mpstate", ".", "settings", ".", "compdebug", "&", "2", ")", "!=", "0", ":", "return", "if", "mpstate", ".", "settings", ".", "heartbea...
run periodic checks
[ "run", "periodic", "checks" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/mavproxy.py#L707-L743
235,468
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/mavproxy.py
MPState.master
def master(self): '''return the currently chosen mavlink master object''' if len(self.mav_master) == 0: return None if self.settings.link > len(self.mav_master): self.settings.link = 1 # try to use one with no link error if not self.mav_master[self.setti...
python
def master(self): '''return the currently chosen mavlink master object''' if len(self.mav_master) == 0: return None if self.settings.link > len(self.mav_master): self.settings.link = 1 # try to use one with no link error if not self.mav_master[self.setti...
[ "def", "master", "(", "self", ")", ":", "if", "len", "(", "self", ".", "mav_master", ")", "==", "0", ":", "return", "None", "if", "self", ".", "settings", ".", "link", ">", "len", "(", "self", ".", "mav_master", ")", ":", "self", ".", "settings", ...
return the currently chosen mavlink master object
[ "return", "the", "currently", "chosen", "mavlink", "master", "object" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/mavproxy.py#L223-L235
235,469
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_cs.py
generate
def generate(basename, xml): '''generate complete MAVLink CSharp implemenation''' structsfilename = basename + '.generated.cs' msgs = [] enums = [] filelist = [] for x in xml: msgs.extend(x.message) enums.extend(x.enum) filelist.append(os.path.basename(x.filename)) ...
python
def generate(basename, xml): '''generate complete MAVLink CSharp implemenation''' structsfilename = basename + '.generated.cs' msgs = [] enums = [] filelist = [] for x in xml: msgs.extend(x.message) enums.extend(x.enum) filelist.append(os.path.basename(x.filename)) ...
[ "def", "generate", "(", "basename", ",", "xml", ")", ":", "structsfilename", "=", "basename", "+", "'.generated.cs'", "msgs", "=", "[", "]", "enums", "=", "[", "]", "filelist", "=", "[", "]", "for", "x", "in", "xml", ":", "msgs", ".", "extend", "(", ...
generate complete MAVLink CSharp implemenation
[ "generate", "complete", "MAVLink", "CSharp", "implemenation" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_cs.py#L254-L343
235,470
JdeRobot/base
src/tools/colorTuner_py/QDarkStyleSheet/qdarkstyle/__init__.py
load_stylesheet
def load_stylesheet(pyside=True): """ Loads the stylesheet. Takes care of importing the rc module. :param pyside: True to load the pyside rc file, False to load the PyQt rc file :return the stylesheet string """ # Smart import of the rc file if pyside: import qdarkstyle.pyside_styl...
python
def load_stylesheet(pyside=True): """ Loads the stylesheet. Takes care of importing the rc module. :param pyside: True to load the pyside rc file, False to load the PyQt rc file :return the stylesheet string """ # Smart import of the rc file if pyside: import qdarkstyle.pyside_styl...
[ "def", "load_stylesheet", "(", "pyside", "=", "True", ")", ":", "# Smart import of the rc file", "if", "pyside", ":", "import", "qdarkstyle", ".", "pyside_style_rc", "else", ":", "import", "qdarkstyle", ".", "pyqt_style_rc", "# Load the stylesheet content from resources",...
Loads the stylesheet. Takes care of importing the rc module. :param pyside: True to load the pyside rc file, False to load the PyQt rc file :return the stylesheet string
[ "Loads", "the", "stylesheet", ".", "Takes", "care", "of", "importing", "the", "rc", "module", "." ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/tools/colorTuner_py/QDarkStyleSheet/qdarkstyle/__init__.py#L42-L81
235,471
JdeRobot/base
src/tools/colorTuner_py/QDarkStyleSheet/qdarkstyle/__init__.py
load_stylesheet_pyqt5
def load_stylesheet_pyqt5(): """ Loads the stylesheet for use in a pyqt5 application. :param pyside: True to load the pyside rc file, False to load the PyQt rc file :return the stylesheet string """ # Smart import of the rc file import qdarkstyle.pyqt5_style_rc # Load the stylesheet c...
python
def load_stylesheet_pyqt5(): """ Loads the stylesheet for use in a pyqt5 application. :param pyside: True to load the pyside rc file, False to load the PyQt rc file :return the stylesheet string """ # Smart import of the rc file import qdarkstyle.pyqt5_style_rc # Load the stylesheet c...
[ "def", "load_stylesheet_pyqt5", "(", ")", ":", "# Smart import of the rc file", "import", "qdarkstyle", ".", "pyqt5_style_rc", "# Load the stylesheet content from resources", "from", "PyQt5", ".", "QtCore", "import", "QFile", ",", "QTextStream", "f", "=", "QFile", "(", ...
Loads the stylesheet for use in a pyqt5 application. :param pyside: True to load the pyside rc file, False to load the PyQt rc file :return the stylesheet string
[ "Loads", "the", "stylesheet", "for", "use", "in", "a", "pyqt5", "application", "." ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/tools/colorTuner_py/QDarkStyleSheet/qdarkstyle/__init__.py#L84-L117
235,472
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_menu.py
MPMenuItem.call_handler
def call_handler(self): '''optionally call a handler function''' if self.handler is None: return call = getattr(self.handler, 'call', None) if call is not None: self.handler_result = call()
python
def call_handler(self): '''optionally call a handler function''' if self.handler is None: return call = getattr(self.handler, 'call', None) if call is not None: self.handler_result = call()
[ "def", "call_handler", "(", "self", ")", ":", "if", "self", ".", "handler", "is", "None", ":", "return", "call", "=", "getattr", "(", "self", ".", "handler", ",", "'call'", ",", "None", ")", "if", "call", "is", "not", "None", ":", "self", ".", "han...
optionally call a handler function
[ "optionally", "call", "a", "handler", "function" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_menu.py#L58-L64
235,473
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_menu.py
MPMenuTop.add
def add(self, items): '''add a submenu''' if not isinstance(items, list): items = [items] for m in items: updated = False for i in range(len(self.items)): if self.items[i].name == m.name: self.items[i] = m ...
python
def add(self, items): '''add a submenu''' if not isinstance(items, list): items = [items] for m in items: updated = False for i in range(len(self.items)): if self.items[i].name == m.name: self.items[i] = m ...
[ "def", "add", "(", "self", ",", "items", ")", ":", "if", "not", "isinstance", "(", "items", ",", "list", ")", ":", "items", "=", "[", "items", "]", "for", "m", "in", "items", ":", "updated", "=", "False", "for", "i", "in", "range", "(", "len", ...
add a submenu
[ "add", "a", "submenu" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_menu.py#L216-L227
235,474
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_menu.py
MPMenuChildMessageDialog.call
def call(self): '''show the dialog as a child process''' mp_util.child_close_fds() import wx_processguard from wx_loader import wx from wx.lib.agw.genericmessagedialog import GenericMessageDialog app = wx.App(False) # note! font size change is not working. I don't...
python
def call(self): '''show the dialog as a child process''' mp_util.child_close_fds() import wx_processguard from wx_loader import wx from wx.lib.agw.genericmessagedialog import GenericMessageDialog app = wx.App(False) # note! font size change is not working. I don't...
[ "def", "call", "(", "self", ")", ":", "mp_util", ".", "child_close_fds", "(", ")", "import", "wx_processguard", "from", "wx_loader", "import", "wx", "from", "wx", ".", "lib", ".", "agw", ".", "genericmessagedialog", "import", "GenericMessageDialog", "app", "="...
show the dialog as a child process
[ "show", "the", "dialog", "as", "a", "child", "process" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_menu.py#L299-L311
235,475
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/GAreader.py
ERMap.read_ermapper
def read_ermapper(self, ifile): '''Read in a DEM file and associated .ers file''' ers_index = ifile.find('.ers') if ers_index > 0: data_file = ifile[0:ers_index] header_file = ifile else: data_file = ifile header_file = ifile + '.ers' ...
python
def read_ermapper(self, ifile): '''Read in a DEM file and associated .ers file''' ers_index = ifile.find('.ers') if ers_index > 0: data_file = ifile[0:ers_index] header_file = ifile else: data_file = ifile header_file = ifile + '.ers' ...
[ "def", "read_ermapper", "(", "self", ",", "ifile", ")", ":", "ers_index", "=", "ifile", ".", "find", "(", "'.ers'", ")", "if", "ers_index", ">", "0", ":", "data_file", "=", "ifile", "[", "0", ":", "ers_index", "]", "header_file", "=", "ifile", "else", ...
Read in a DEM file and associated .ers file
[ "Read", "in", "a", "DEM", "file", "and", "associated", ".", "ers", "file" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/GAreader.py#L25-L59
235,476
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/GAreader.py
ERMap.printBoundingBox
def printBoundingBox(self): '''Print the bounding box that this DEM covers''' print ("Bounding Latitude: ") print (self.startlatitude) print (self.endlatitude) print ("Bounding Longitude: ") print (self.startlongitude) print (self.endlongitude)
python
def printBoundingBox(self): '''Print the bounding box that this DEM covers''' print ("Bounding Latitude: ") print (self.startlatitude) print (self.endlatitude) print ("Bounding Longitude: ") print (self.startlongitude) print (self.endlongitude)
[ "def", "printBoundingBox", "(", "self", ")", ":", "print", "(", "\"Bounding Latitude: \"", ")", "print", "(", "self", ".", "startlatitude", ")", "print", "(", "self", ".", "endlatitude", ")", "print", "(", "\"Bounding Longitude: \"", ")", "print", "(", "self",...
Print the bounding box that this DEM covers
[ "Print", "the", "bounding", "box", "that", "this", "DEM", "covers" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/GAreader.py#L92-L100
235,477
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/GAreader.py
ERMap.getPercentBlank
def getPercentBlank(self): '''Print how many null cells are in the DEM - Quality measure''' blank = 0 nonblank = 0 for x in self.data.flat: if x == -99999.0: blank = blank + 1 else: nonblank = nonblank + 1 print ("Blank til...
python
def getPercentBlank(self): '''Print how many null cells are in the DEM - Quality measure''' blank = 0 nonblank = 0 for x in self.data.flat: if x == -99999.0: blank = blank + 1 else: nonblank = nonblank + 1 print ("Blank til...
[ "def", "getPercentBlank", "(", "self", ")", ":", "blank", "=", "0", "nonblank", "=", "0", "for", "x", "in", "self", ".", "data", ".", "flat", ":", "if", "x", "==", "-", "99999.0", ":", "blank", "=", "blank", "+", "1", "else", ":", "nonblank", "="...
Print how many null cells are in the DEM - Quality measure
[ "Print", "how", "many", "null", "cells", "are", "in", "the", "DEM", "-", "Quality", "measure" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/GAreader.py#L102-L112
235,478
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_rc.py
RCModule.send_rc_override
def send_rc_override(self): '''send RC override packet''' if self.sitl_output: buf = struct.pack('<HHHHHHHH', *self.override) self.sitl_output.write(buf) else: self.master.mav.rc_channels_override_send(self.target_system, ...
python
def send_rc_override(self): '''send RC override packet''' if self.sitl_output: buf = struct.pack('<HHHHHHHH', *self.override) self.sitl_output.write(buf) else: self.master.mav.rc_channels_override_send(self.target_system, ...
[ "def", "send_rc_override", "(", "self", ")", ":", "if", "self", ".", "sitl_output", ":", "buf", "=", "struct", ".", "pack", "(", "'<HHHHHHHH'", ",", "*", "self", ".", "override", ")", "self", ".", "sitl_output", ".", "write", "(", "buf", ")", "else", ...
send RC override packet
[ "send", "RC", "override", "packet" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_rc.py#L31-L40
235,479
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_rc.py
RCModule.cmd_switch
def cmd_switch(self, args): '''handle RC switch changes''' mapping = [ 0, 1165, 1295, 1425, 1555, 1685, 1815 ] if len(args) != 1: print("Usage: switch <pwmvalue>") return value = int(args[0]) if value < 0 or value > 6: print("Invalid switch val...
python
def cmd_switch(self, args): '''handle RC switch changes''' mapping = [ 0, 1165, 1295, 1425, 1555, 1685, 1815 ] if len(args) != 1: print("Usage: switch <pwmvalue>") return value = int(args[0]) if value < 0 or value > 6: print("Invalid switch val...
[ "def", "cmd_switch", "(", "self", ",", "args", ")", ":", "mapping", "=", "[", "0", ",", "1165", ",", "1295", ",", "1425", ",", "1555", ",", "1685", ",", "1815", "]", "if", "len", "(", "args", ")", "!=", "1", ":", "print", "(", "\"Usage: switch <p...
handle RC switch changes
[ "handle", "RC", "switch", "changes" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_rc.py#L42-L67
235,480
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/lib/ANUGA/geo_reference.py
write_NetCDF_georeference
def write_NetCDF_georeference(origin, outfile): """Write georeference info to a netcdf file, usually sww. The origin can be a georef instance or parameters for a geo_ref instance outfile is the name of the file to be written to. """ geo_ref = ensure_geo_reference(origin) geo_ref.write_NetCDF(...
python
def write_NetCDF_georeference(origin, outfile): """Write georeference info to a netcdf file, usually sww. The origin can be a georef instance or parameters for a geo_ref instance outfile is the name of the file to be written to. """ geo_ref = ensure_geo_reference(origin) geo_ref.write_NetCDF(...
[ "def", "write_NetCDF_georeference", "(", "origin", ",", "outfile", ")", ":", "geo_ref", "=", "ensure_geo_reference", "(", "origin", ")", "geo_ref", ".", "write_NetCDF", "(", "outfile", ")", "return", "geo_ref" ]
Write georeference info to a netcdf file, usually sww. The origin can be a georef instance or parameters for a geo_ref instance outfile is the name of the file to be written to.
[ "Write", "georeference", "info", "to", "a", "netcdf", "file", "usually", "sww", "." ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/lib/ANUGA/geo_reference.py#L430-L440
235,481
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/lib/ANUGA/geo_reference.py
Geo_reference.is_absolute
def is_absolute(self): """Return True if xllcorner==yllcorner==0 indicating that points in question are absolute. """ # FIXME(Ole): It is unfortunate that decision about whether points # are absolute or not lies with the georeference object. Ross pointed this out. # More...
python
def is_absolute(self): """Return True if xllcorner==yllcorner==0 indicating that points in question are absolute. """ # FIXME(Ole): It is unfortunate that decision about whether points # are absolute or not lies with the georeference object. Ross pointed this out. # More...
[ "def", "is_absolute", "(", "self", ")", ":", "# FIXME(Ole): It is unfortunate that decision about whether points", "# are absolute or not lies with the georeference object. Ross pointed this out.", "# Moreover, this little function is responsible for a large fraction of the time", "# using in data...
Return True if xllcorner==yllcorner==0 indicating that points in question are absolute.
[ "Return", "True", "if", "xllcorner", "==", "yllcorner", "==", "0", "indicating", "that", "points", "in", "question", "are", "absolute", "." ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/lib/ANUGA/geo_reference.py#L275-L293
235,482
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_util.py
mkdir_p
def mkdir_p(dir): '''like mkdir -p''' if not dir: return if dir.endswith("/") or dir.endswith("\\"): mkdir_p(dir[:-1]) return if os.path.isdir(dir): return mkdir_p(os.path.dirname(dir)) try: os.mkdir(dir) except Exception: pass
python
def mkdir_p(dir): '''like mkdir -p''' if not dir: return if dir.endswith("/") or dir.endswith("\\"): mkdir_p(dir[:-1]) return if os.path.isdir(dir): return mkdir_p(os.path.dirname(dir)) try: os.mkdir(dir) except Exception: pass
[ "def", "mkdir_p", "(", "dir", ")", ":", "if", "not", "dir", ":", "return", "if", "dir", ".", "endswith", "(", "\"/\"", ")", "or", "dir", ".", "endswith", "(", "\"\\\\\"", ")", ":", "mkdir_p", "(", "dir", "[", ":", "-", "1", "]", ")", "return", ...
like mkdir -p
[ "like", "mkdir", "-", "p" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_util.py#L88-L101
235,483
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_util.py
polygon_load
def polygon_load(filename): '''load a polygon from a file''' ret = [] f = open(filename) for line in f: if line.startswith('#'): continue line = line.strip() if not line: continue a = line.split() if len(a) != 2: raise RuntimeEr...
python
def polygon_load(filename): '''load a polygon from a file''' ret = [] f = open(filename) for line in f: if line.startswith('#'): continue line = line.strip() if not line: continue a = line.split() if len(a) != 2: raise RuntimeEr...
[ "def", "polygon_load", "(", "filename", ")", ":", "ret", "=", "[", "]", "f", "=", "open", "(", "filename", ")", "for", "line", "in", "f", ":", "if", "line", ".", "startswith", "(", "'#'", ")", ":", "continue", "line", "=", "line", ".", "strip", "...
load a polygon from a file
[ "load", "a", "polygon", "from", "a", "file" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_util.py#L103-L118
235,484
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_util.py
bounds_overlap
def bounds_overlap(bound1, bound2): '''return true if two bounding boxes overlap''' (x1,y1,w1,h1) = bound1 (x2,y2,w2,h2) = bound2 if x1+w1 < x2: return False if x2+w2 < x1: return False if y1+h1 < y2: return False if y2+h2 < y1: return False return True
python
def bounds_overlap(bound1, bound2): '''return true if two bounding boxes overlap''' (x1,y1,w1,h1) = bound1 (x2,y2,w2,h2) = bound2 if x1+w1 < x2: return False if x2+w2 < x1: return False if y1+h1 < y2: return False if y2+h2 < y1: return False return True
[ "def", "bounds_overlap", "(", "bound1", ",", "bound2", ")", ":", "(", "x1", ",", "y1", ",", "w1", ",", "h1", ")", "=", "bound1", "(", "x2", ",", "y2", ",", "w2", ",", "h2", ")", "=", "bound2", "if", "x1", "+", "w1", "<", "x2", ":", "return", ...
return true if two bounding boxes overlap
[ "return", "true", "if", "two", "bounding", "boxes", "overlap" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_util.py#L132-L144
235,485
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_util.py
latlon_to_grid
def latlon_to_grid(latlon): '''convert to grid reference''' from MAVProxy.modules.lib.ANUGA import redfearn (zone, easting, northing) = redfearn.redfearn(latlon[0], latlon[1]) if latlon[0] < 0: hemisphere = 'S' else: hemisphere = 'N' return UTMGrid(zone, easting, northing, hemisp...
python
def latlon_to_grid(latlon): '''convert to grid reference''' from MAVProxy.modules.lib.ANUGA import redfearn (zone, easting, northing) = redfearn.redfearn(latlon[0], latlon[1]) if latlon[0] < 0: hemisphere = 'S' else: hemisphere = 'N' return UTMGrid(zone, easting, northing, hemisp...
[ "def", "latlon_to_grid", "(", "latlon", ")", ":", "from", "MAVProxy", ".", "modules", ".", "lib", ".", "ANUGA", "import", "redfearn", "(", "zone", ",", "easting", ",", "northing", ")", "=", "redfearn", ".", "redfearn", "(", "latlon", "[", "0", "]", ","...
convert to grid reference
[ "convert", "to", "grid", "reference" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_util.py#L189-L197
235,486
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_util.py
latlon_round
def latlon_round(latlon, spacing=1000): '''round to nearest grid corner''' g = latlon_to_grid(latlon) g.easting = (g.easting // spacing) * spacing g.northing = (g.northing // spacing) * spacing return g.latlon()
python
def latlon_round(latlon, spacing=1000): '''round to nearest grid corner''' g = latlon_to_grid(latlon) g.easting = (g.easting // spacing) * spacing g.northing = (g.northing // spacing) * spacing return g.latlon()
[ "def", "latlon_round", "(", "latlon", ",", "spacing", "=", "1000", ")", ":", "g", "=", "latlon_to_grid", "(", "latlon", ")", "g", ".", "easting", "=", "(", "g", ".", "easting", "//", "spacing", ")", "*", "spacing", "g", ".", "northing", "=", "(", "...
round to nearest grid corner
[ "round", "to", "nearest", "grid", "corner" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_util.py#L199-L204
235,487
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_util.py
wxToPIL
def wxToPIL(wimg): '''convert a wxImage to a PIL Image''' from PIL import Image (w,h) = wimg.GetSize() d = wimg.GetData() pimg = Image.new("RGB", (w,h), color=1) pimg.fromstring(d) return pimg
python
def wxToPIL(wimg): '''convert a wxImage to a PIL Image''' from PIL import Image (w,h) = wimg.GetSize() d = wimg.GetData() pimg = Image.new("RGB", (w,h), color=1) pimg.fromstring(d) return pimg
[ "def", "wxToPIL", "(", "wimg", ")", ":", "from", "PIL", "import", "Image", "(", "w", ",", "h", ")", "=", "wimg", ".", "GetSize", "(", ")", "d", "=", "wimg", ".", "GetData", "(", ")", "pimg", "=", "Image", ".", "new", "(", "\"RGB\"", ",", "(", ...
convert a wxImage to a PIL Image
[ "convert", "a", "wxImage", "to", "a", "PIL", "Image" ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_util.py#L207-L214
235,488
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_util.py
child_close_fds
def child_close_fds(): '''close file descriptors that a child process should not inherit. Should be called from child processes.''' global child_fd_list import os while len(child_fd_list) > 0: fd = child_fd_list.pop(0) try: os.close(fd) except Exception as msg:...
python
def child_close_fds(): '''close file descriptors that a child process should not inherit. Should be called from child processes.''' global child_fd_list import os while len(child_fd_list) > 0: fd = child_fd_list.pop(0) try: os.close(fd) except Exception as msg:...
[ "def", "child_close_fds", "(", ")", ":", "global", "child_fd_list", "import", "os", "while", "len", "(", "child_fd_list", ")", ">", "0", ":", "fd", "=", "child_fd_list", ".", "pop", "(", "0", ")", "try", ":", "os", ".", "close", "(", "fd", ")", "exce...
close file descriptors that a child process should not inherit. Should be called from child processes.
[ "close", "file", "descriptors", "that", "a", "child", "process", "should", "not", "inherit", ".", "Should", "be", "called", "from", "child", "processes", "." ]
303b18992785b2fe802212f2d758a60873007f1f
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_util.py#L256-L266
235,489
spaam/svtplay-dl
scripts/cibuild.py
snapshot_folder
def snapshot_folder(): """ Use the commit date in UTC as folder name """ logger.info("Snapshot folder") try: stdout = subprocess.check_output(["git", "show", "-s", "--format=%cI", "HEAD"]) except subprocess.CalledProcessError as e: logger.error("Error: {}".format(e.output.decode(...
python
def snapshot_folder(): """ Use the commit date in UTC as folder name """ logger.info("Snapshot folder") try: stdout = subprocess.check_output(["git", "show", "-s", "--format=%cI", "HEAD"]) except subprocess.CalledProcessError as e: logger.error("Error: {}".format(e.output.decode(...
[ "def", "snapshot_folder", "(", ")", ":", "logger", ".", "info", "(", "\"Snapshot folder\"", ")", "try", ":", "stdout", "=", "subprocess", ".", "check_output", "(", "[", "\"git\"", ",", "\"show\"", ",", "\"-s\"", ",", "\"--format=%cI\"", ",", "\"HEAD\"", "]",...
Use the commit date in UTC as folder name
[ "Use", "the", "commit", "date", "in", "UTC", "as", "folder", "name" ]
d33186e54e436ebb1537e5baf67758e3bd3bf076
https://github.com/spaam/svtplay-dl/blob/d33186e54e436ebb1537e5baf67758e3bd3bf076/scripts/cibuild.py#L76-L92
235,490
spaam/svtplay-dl
lib/svtplay_dl/service/__init__.py
opengraph_get
def opengraph_get(html, prop): """ Extract specified OpenGraph property from html. >>> opengraph_get('<html><head><meta property="og:image" content="http://example.com/img.jpg"><meta ...', "image") 'http://example.com/img.jpg' >>> opengraph_get('<html><head><meta content="http://example...
python
def opengraph_get(html, prop): """ Extract specified OpenGraph property from html. >>> opengraph_get('<html><head><meta property="og:image" content="http://example.com/img.jpg"><meta ...', "image") 'http://example.com/img.jpg' >>> opengraph_get('<html><head><meta content="http://example...
[ "def", "opengraph_get", "(", "html", ",", "prop", ")", ":", "match", "=", "re", ".", "search", "(", "'<meta [^>]*property=\"og:'", "+", "prop", "+", "'\" content=\"([^\"]*)\"'", ",", "html", ")", "if", "match", "is", "None", ":", "match", "=", "re", ".", ...
Extract specified OpenGraph property from html. >>> opengraph_get('<html><head><meta property="og:image" content="http://example.com/img.jpg"><meta ...', "image") 'http://example.com/img.jpg' >>> opengraph_get('<html><head><meta content="http://example.com/img2.jpg" property="og:image"><meta .....
[ "Extract", "specified", "OpenGraph", "property", "from", "html", "." ]
d33186e54e436ebb1537e5baf67758e3bd3bf076
https://github.com/spaam/svtplay-dl/blob/d33186e54e436ebb1537e5baf67758e3bd3bf076/lib/svtplay_dl/service/__init__.py#L82-L98
235,491
spaam/svtplay-dl
lib/svtplay_dl/utils/text.py
decode_html_entities
def decode_html_entities(s): """ Replaces html entities with the character they represent. >>> print(decode_html_entities("&lt;3 &amp;")) <3 & """ parser = HTMLParser.HTMLParser() def unesc(m): return parser.unescape(m.group()) return re.sub(r'(&[^;]+;)', unesc, ensure_...
python
def decode_html_entities(s): """ Replaces html entities with the character they represent. >>> print(decode_html_entities("&lt;3 &amp;")) <3 & """ parser = HTMLParser.HTMLParser() def unesc(m): return parser.unescape(m.group()) return re.sub(r'(&[^;]+;)', unesc, ensure_...
[ "def", "decode_html_entities", "(", "s", ")", ":", "parser", "=", "HTMLParser", ".", "HTMLParser", "(", ")", "def", "unesc", "(", "m", ")", ":", "return", "parser", ".", "unescape", "(", "m", ".", "group", "(", ")", ")", "return", "re", ".", "sub", ...
Replaces html entities with the character they represent. >>> print(decode_html_entities("&lt;3 &amp;")) <3 &
[ "Replaces", "html", "entities", "with", "the", "character", "they", "represent", "." ]
d33186e54e436ebb1537e5baf67758e3bd3bf076
https://github.com/spaam/svtplay-dl/blob/d33186e54e436ebb1537e5baf67758e3bd3bf076/lib/svtplay_dl/utils/text.py#L17-L28
235,492
spaam/svtplay-dl
lib/svtplay_dl/utils/text.py
filenamify
def filenamify(title): """ Convert a string to something suitable as a file name. E.g. Matlagning del 1 av 10 - Räksmörgås | SVT Play -> matlagning.del.1.av.10.-.raksmorgas.svt.play """ # ensure it is unicode title = ensure_unicode(title) # NFD decomposes chars into base char and ...
python
def filenamify(title): """ Convert a string to something suitable as a file name. E.g. Matlagning del 1 av 10 - Räksmörgås | SVT Play -> matlagning.del.1.av.10.-.raksmorgas.svt.play """ # ensure it is unicode title = ensure_unicode(title) # NFD decomposes chars into base char and ...
[ "def", "filenamify", "(", "title", ")", ":", "# ensure it is unicode", "title", "=", "ensure_unicode", "(", "title", ")", "# NFD decomposes chars into base char and diacritical mark, which", "# means that we will get base char when we strip out non-ascii.", "title", "=", "unicodeda...
Convert a string to something suitable as a file name. E.g. Matlagning del 1 av 10 - Räksmörgås | SVT Play -> matlagning.del.1.av.10.-.raksmorgas.svt.play
[ "Convert", "a", "string", "to", "something", "suitable", "as", "a", "file", "name", ".", "E", ".", "g", "." ]
d33186e54e436ebb1537e5baf67758e3bd3bf076
https://github.com/spaam/svtplay-dl/blob/d33186e54e436ebb1537e5baf67758e3bd3bf076/lib/svtplay_dl/utils/text.py#L31-L54
235,493
spaam/svtplay-dl
lib/svtplay_dl/fetcher/http.py
HTTP.download
def download(self): """ Get the stream from HTTP """ _, ext = os.path.splitext(self.url) if ext == ".mp3": self.output_extention = "mp3" else: self.output_extention = "mp4" # this might be wrong.. data = self.http.request("get", self.url, stream=True) ...
python
def download(self): """ Get the stream from HTTP """ _, ext = os.path.splitext(self.url) if ext == ".mp3": self.output_extention = "mp3" else: self.output_extention = "mp4" # this might be wrong.. data = self.http.request("get", self.url, stream=True) ...
[ "def", "download", "(", "self", ")", ":", "_", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "self", ".", "url", ")", "if", "ext", "==", "\".mp3\"", ":", "self", ".", "output_extention", "=", "\"mp3\"", "else", ":", "self", ".", "output...
Get the stream from HTTP
[ "Get", "the", "stream", "from", "HTTP" ]
d33186e54e436ebb1537e5baf67758e3bd3bf076
https://github.com/spaam/svtplay-dl/blob/d33186e54e436ebb1537e5baf67758e3bd3bf076/lib/svtplay_dl/fetcher/http.py#L15-L43
235,494
spaam/svtplay-dl
lib/svtplay_dl/utils/output.py
progress
def progress(byte, total, extra=""): """ Print some info about how much we have downloaded """ if total == 0: progresstr = "Downloaded %dkB bytes" % (byte >> 10) progress_stream.write(progresstr + '\r') return progressbar(total, byte, extra)
python
def progress(byte, total, extra=""): """ Print some info about how much we have downloaded """ if total == 0: progresstr = "Downloaded %dkB bytes" % (byte >> 10) progress_stream.write(progresstr + '\r') return progressbar(total, byte, extra)
[ "def", "progress", "(", "byte", ",", "total", ",", "extra", "=", "\"\"", ")", ":", "if", "total", "==", "0", ":", "progresstr", "=", "\"Downloaded %dkB bytes\"", "%", "(", "byte", ">>", "10", ")", "progress_stream", ".", "write", "(", "progresstr", "+", ...
Print some info about how much we have downloaded
[ "Print", "some", "info", "about", "how", "much", "we", "have", "downloaded" ]
d33186e54e436ebb1537e5baf67758e3bd3bf076
https://github.com/spaam/svtplay-dl/blob/d33186e54e436ebb1537e5baf67758e3bd3bf076/lib/svtplay_dl/utils/output.py#L80-L86
235,495
spaam/svtplay-dl
lib/svtplay_dl/utils/output.py
ETA.update
def update(self, pos): """ Set new absolute progress position. Parameters: pos: new absolute progress """ self.pos = pos self.now = time.time()
python
def update(self, pos): """ Set new absolute progress position. Parameters: pos: new absolute progress """ self.pos = pos self.now = time.time()
[ "def", "update", "(", "self", ",", "pos", ")", ":", "self", ".", "pos", "=", "pos", "self", ".", "now", "=", "time", ".", "time", "(", ")" ]
Set new absolute progress position. Parameters: pos: new absolute progress
[ "Set", "new", "absolute", "progress", "position", "." ]
d33186e54e436ebb1537e5baf67758e3bd3bf076
https://github.com/spaam/svtplay-dl/blob/d33186e54e436ebb1537e5baf67758e3bd3bf076/lib/svtplay_dl/utils/output.py#L39-L47
235,496
ArduPilot/MAVProxy
MAVProxy/modules/lib/graph_ui.py
Graph_UI.check_xlim_change
def check_xlim_change(self): '''check for new X bounds''' if self.xlim_pipe is None: return None xlim = None while self.xlim_pipe[0].poll(): try: xlim = self.xlim_pipe[0].recv() except EOFError: return None if xl...
python
def check_xlim_change(self): '''check for new X bounds''' if self.xlim_pipe is None: return None xlim = None while self.xlim_pipe[0].poll(): try: xlim = self.xlim_pipe[0].recv() except EOFError: return None if xl...
[ "def", "check_xlim_change", "(", "self", ")", ":", "if", "self", ".", "xlim_pipe", "is", "None", ":", "return", "None", "xlim", "=", "None", "while", "self", ".", "xlim_pipe", "[", "0", "]", ".", "poll", "(", ")", ":", "try", ":", "xlim", "=", "sel...
check for new X bounds
[ "check", "for", "new", "X", "bounds" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/graph_ui.py#L50-L62
235,497
ArduPilot/MAVProxy
MAVProxy/modules/lib/graph_ui.py
Graph_UI.set_xlim
def set_xlim(self, xlim): '''set new X bounds''' if self.xlim_pipe is not None and self.xlim != xlim: #print("send0: ", graph_count, xlim) try: self.xlim_pipe[0].send(xlim) except IOError: return False self.xlim = xlim ...
python
def set_xlim(self, xlim): '''set new X bounds''' if self.xlim_pipe is not None and self.xlim != xlim: #print("send0: ", graph_count, xlim) try: self.xlim_pipe[0].send(xlim) except IOError: return False self.xlim = xlim ...
[ "def", "set_xlim", "(", "self", ",", "xlim", ")", ":", "if", "self", ".", "xlim_pipe", "is", "not", "None", "and", "self", ".", "xlim", "!=", "xlim", ":", "#print(\"send0: \", graph_count, xlim)", "try", ":", "self", ".", "xlim_pipe", "[", "0", "]", ".",...
set new X bounds
[ "set", "new", "X", "bounds" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/graph_ui.py#L64-L73
235,498
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_serial.py
SerialModule.serial_lock
def serial_lock(self, lock): '''lock or unlock the port''' mav = self.master.mav if lock: flags = mavutil.mavlink.SERIAL_CONTROL_FLAG_EXCLUSIVE self.locked = True else: flags = 0 self.locked = False mav.serial_control_send(self.seri...
python
def serial_lock(self, lock): '''lock or unlock the port''' mav = self.master.mav if lock: flags = mavutil.mavlink.SERIAL_CONTROL_FLAG_EXCLUSIVE self.locked = True else: flags = 0 self.locked = False mav.serial_control_send(self.seri...
[ "def", "serial_lock", "(", "self", ",", "lock", ")", ":", "mav", "=", "self", ".", "master", ".", "mav", "if", "lock", ":", "flags", "=", "mavutil", ".", "mavlink", ".", "SERIAL_CONTROL_FLAG_EXCLUSIVE", "self", ".", "locked", "=", "True", "else", ":", ...
lock or unlock the port
[ "lock", "or", "unlock", "the", "port" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_serial.py#L32-L43
235,499
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_serial.py
SerialModule.cmd_serial
def cmd_serial(self, args): '''serial control commands''' usage = "Usage: serial <lock|unlock|set|send>" if len(args) < 1: print(usage) return if args[0] == "lock": self.serial_lock(True) elif args[0] == "unlock": self.serial_lock(F...
python
def cmd_serial(self, args): '''serial control commands''' usage = "Usage: serial <lock|unlock|set|send>" if len(args) < 1: print(usage) return if args[0] == "lock": self.serial_lock(True) elif args[0] == "unlock": self.serial_lock(F...
[ "def", "cmd_serial", "(", "self", ",", "args", ")", ":", "usage", "=", "\"Usage: serial <lock|unlock|set|send>\"", "if", "len", "(", "args", ")", "<", "1", ":", "print", "(", "usage", ")", "return", "if", "args", "[", "0", "]", "==", "\"lock\"", ":", "...
serial control commands
[ "serial", "control", "commands" ]
f50bdeff33064876f7dc8dc4683d278ff47f75d5
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_serial.py#L67-L82