Skip to content

Commit e93989f

Browse files
authored
Jazzy Phidgets IMU Filter (#159)
* Add imu data topic to Phidget diagnostics * Check for IMU index
1 parent 7b3dea9 commit e93989f

File tree

1 file changed

+7
-5
lines changed
  • clearpath_generator_common/clearpath_generator_common/param

1 file changed

+7
-5
lines changed

clearpath_generator_common/clearpath_generator_common/param/platform.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ def generate_parameters(self, use_sim_time: bool = False) -> None:
302302
self.add_topic(sensor, sensor.TOPICS.POINTS)
303303

304304
case PhidgetsSpatial():
305+
self.add_topic(sensor, sensor.TOPICS.DATA),
305306
self.add_topic(sensor, sensor.TOPICS.RAW_DATA),
306307
self.add_topic(sensor, sensor.TOPICS.MAG),
307308

@@ -341,7 +342,10 @@ def generate_parameters(self, use_sim_time: bool = False) -> None:
341342
if extras:
342343
self.param_file.update({self.EKF_NODE: extras})
343344
else:
344-
if self.platform != Platform.A200:
345+
# Count the IMU index individually so we can continue counting for GPS
346+
imu_idx = 0
347+
348+
if Platform.INDEX[self.platform].imu > 0:
345349
imu0_parameters = {
346350
'imu0': 'sensors/imu_0/data',
347351
'imu0_config': self.imu_config,
@@ -351,15 +355,12 @@ def generate_parameters(self, use_sim_time: bool = False) -> None:
351355
'imu0_remove_gravitational_acceleration': True
352356
}
353357
self.param_file.update({self.EKF_NODE: imu0_parameters})
354-
355-
# Count the IMU index individually so we can continue counting for GPS
356-
imu_idx = 0
358+
imu_idx += 1
357359

358360
# Add all additional IMU's
359361
imus = self.clearpath_config.sensors.get_all_imu()
360362
for imu in imus:
361363
if imu.launch_enabled:
362-
imu_idx += 1
363364
imu_name = f'imu{imu_idx}'
364365
imu_parameters = {
365366
imu_name: f'sensors/{imu.name}/data',
@@ -369,6 +370,7 @@ def generate_parameters(self, use_sim_time: bool = False) -> None:
369370
f'{imu_name}_remove_gravitational_acceleration': True
370371
}
371372
self.param_file.update({self.EKF_NODE: imu_parameters})
373+
imu_idx += 1
372374

373375
# Add all GPS sensors that have IMUs
374376
gpss = self.clearpath_config.sensors.get_all_gps()

0 commit comments

Comments
 (0)