update msgs fields from camelCase to snake_case so rosidl_generate_interfaces() is able to generate code for ROS IDL files

This commit is contained in:
TSC21
2018-07-30 21:40:28 +02:00
committed by Lorenz Meier
parent 553d68b80f
commit ca42483794
14 changed files with 58 additions and 52 deletions
+4 -5
View File
@@ -1,12 +1,12 @@
float32 voltage5V_v # peripheral 5V rail voltage
float32 voltage3V3_v # Sensor 3V3 rail voltage
float32 voltage5v_v # peripheral 5V rail voltage
float32 voltage3v3_v # Sensor 3V3 rail voltage
uint8 v3v3_valid # Sensor 3V3 rail voltage was read.
uint8 usb_connected # USB is connected when 1
uint8 brick_valid # brick bits power is good when bit 1
uint8 usb_valid # USB is valid when 1
uint8 servo_valid # servo power is good when 1
uint8 periph_5V_OC # peripheral overcurrent when 1
uint8 hipower_5V_OC # hi power peripheral overcurrent when 1
uint8 periph_5v_oc # peripheral overcurrent when 1
uint8 hipower_5v_oc # hi power peripheral overcurrent when 1
uint8 BRICK1_VALID_SHIFTS=0
uint8 BRICK1_VALID_MASK=1
@@ -16,4 +16,3 @@ uint8 BRICK3_VALID_SHIFTS=2
uint8 BRICK3_VALID_MASK=4
uint8 BRICK4_VALID_SHIFTS=3
uint8 BRICK4_VALID_MASK=8
+10 -10
View File
@@ -7,19 +7,19 @@ uint8 TECS_MODE_BAD_DESCENT = 5
uint8 TECS_MODE_CLIMBOUT = 6
float32 altitudeSp
float32 altitude_sp
float32 altitude_filtered
float32 flightPathAngleSp
float32 flightPathAngle
float32 airspeedSp
float32 flight_path_angle_sp
float32 flight_path_angle
float32 airspeed_sp
float32 airspeed_filtered
float32 airspeedDerivativeSp
float32 airspeedDerivative
float32 airspeed_derivative_sp
float32 airspeed_derivative
float32 totalEnergyError
float32 energyDistributionError
float32 totalEnergyRateError
float32 energyDistributionRateError
float32 total_energy_error
float32 energy_distribution_error
float32 total_energy_rate_error
float32 energy_distribution_rate_error
float32 throttle_integ
float32 pitch_integ
+8 -1
View File
@@ -107,7 +107,7 @@ def sizeof_field_type(field):
def get_children_fields(base_type, search_path):
(package, name) = genmsg.names.package_resource_name(base_type)
tmp_msg_context = genmsg.msg_loader.MsgContext.create_default()
spec_temp = genmsg.msg_loader.load_msg_by_type(tmp_msg_context, '%s/%s' %(package, name), search_path)
spec_temp = genmsg.msg_loader.load_msg_by_type(tmp_msg_context, '%s/%s' %(package, name), search_path)
sorted_fields = sorted(spec_temp.parsed_fields(), key=sizeof_field_type, reverse=True)
return sorted_fields
@@ -184,6 +184,9 @@ def print_field(field):
Echo printf line
"""
# check if there are any upper case letters in the field name
assert not any(a.isupper() for a in field.name), "%r field contains uppercase letters" % field.name
# skip padding
if field.name.startswith('_padding'):
return
@@ -250,6 +253,10 @@ def print_field_def(field):
"""
Print the C type from a field
"""
# check if there are any upper case letters in the field name
assert not any(a.isupper() for a in field.name), "%r field contains uppercase letters" % field.name
type_name = field.type
# detect embedded types
sl_pos = type_name.find('/')
+1 -1
View File
@@ -1,4 +1,4 @@
uint32 ICAO_address # ICAO address
uint32 icao_address # ICAO address
float64 lat # Latitude, expressed as degrees
float64 lon # Longitude, expressed as degrees
uint8 altitude_type # Type from ADSB_ALTITUDE_TYPE enum