Skip to content

Commit 5937cb1

Browse files
committed
Sensors: remove dead code from dronecan script
Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
1 parent 8c24233 commit 5937cb1

1 file changed

Lines changed: 4 additions & 72 deletions

File tree

scripts/dronecan_sensor.py

Lines changed: 4 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -19,73 +19,13 @@
1919
if GZ_VERSION == GZ_VERSION_GARDEN:
2020
from gz.msgs9.model_pb2 import Model
2121
elif GZ_VERSION == GZ_VERSION_HARMONIC:
22-
# from gz.msgs10.air_speed_pb2 import AirSpeed
23-
# from gz.msgs10.altimeter_pb2 import Altimeter
24-
# from gz.msgs10.axis_pb2 import Axis
25-
# from gz.msgs10.axis_aligned_box_pb2 import AxisAlignedBox
26-
# from gz.msgs10.fluid_pressure_pb2 import FluidPressure
27-
# from gz.msgs10.imu_pb2 import IMU
28-
# from gz.msgs10.joint_pb2 import Joint
29-
# from gz.msgs10.link_pb2 import Link
30-
# from gz.msgs10.magnetometer_pb2 import Magnetometer
3122
from gz.msgs10.model_pb2 import Model
32-
# from gz.msgs10.navsat_pb2 import NavSat
33-
# from gz.msgs10.pose_pb2 import Pose
34-
# from gz.msgs10.sensor_pb2 import Sensor
35-
# from gz.msgs10.vector3d_pb2 import Vector3d
36-
# from gz.msgs10.visual_pb2 import Visual
37-
# from gz.msgs10.header_pb2 import Header
3823
elif GZ_VERSION == GZ_VERSION_IONIC:
3924
from gz.msgs11.model_pb2 import Model
4025

4126

42-
# def sensor_topics():
43-
# world = "iris_runway"
44-
# model = "iris_with_gimbal"
45-
# sub_model = "iris_with_standoffs"
46-
# link = "base_link"
47-
48-
# topic = (
49-
# f"/world/{world}/model/{model}"
50-
# f"/model/{sub_model}/link/{link}"
51-
# f"/sensor/air_pressure_sensor/air_pressure"
52-
# )
53-
54-
# topic = (
55-
# f"/world/{world}/model/{model}"
56-
# f"/model/{sub_model}/link/base_link"
57-
# f"/sensor/air_speed_sensor/air_speed"
58-
# )
59-
60-
# topic = (
61-
# f"/world/{world}/model/{model}"
62-
# f"/model/{sub_model}/link/{link}"
63-
# f"/sensor/altimeter_sensor/altimeter"
64-
# )
65-
66-
# topic = (
67-
# f"/world/{world}/model/{model}"
68-
# f"/model/{sub_model}/link/{link}"
69-
# f"/sensor/magnetometer_sensor/magnetometer"
70-
# )
71-
72-
# topic = (
73-
# f"/world/{world}/model/{model}"
74-
# f"/model/{sub_model}/link/{link}"
75-
# f"/sensor/navsat_sensor/navsat"
76-
# )
77-
78-
# link = "imu_link"
79-
80-
# topic = (
81-
# f"/world/{world}/model/{model}"
82-
# f"/model/{sub_model}/link/{link}"
83-
# f"/sensor/imu_sensor/imu"
84-
# )
85-
86-
87-
# Importing gz.transport13 into the module global scope causes an odd conflict
88-
# with dronecan. This is a workaround.
27+
# Importing gz.transport into the module global scope causes an odd
28+
# multiprocessing conflict with dronecan. This is a workaround.
8929
def gz_node():
9030
if GZ_VERSION == GZ_VERSION_GARDEN:
9131
from gz.transport12 import Node
@@ -118,8 +58,8 @@ def _model_cb(self, msg):
11858
self._model_msg = msg
11959
do_print_msg = self._model_do_print_msg
12060

121-
# if do_print_msg:
122-
# print(msg)
61+
if do_print_msg:
62+
print(msg)
12363

12464
def joint_by_name(self, joint_name):
12565
with self._lock:
@@ -184,13 +124,6 @@ def _pub_esc_status(self):
184124
debug = self._debug
185125
rpm = self._rpm
186126

187-
# fake esc data
188-
# s = math.sin(time.time() * math.pi * 2)
189-
# rpm[0] = int(10000 + 1000 * s)
190-
# rpm[1] = int(10500 + 1000 * s)
191-
# rpm[2] = int(11000 + 1000 * s)
192-
# rpm[3] = int(11500 + 1000 * s)
193-
194127
msg = dronecan.uavcan.equipment.esc.Status()
195128

196129
# esc 0, 1, 2, 3
@@ -217,7 +150,6 @@ def _pub_esc_status(self):
217150
self._node.broadcast(msg)
218151

219152
if debug:
220-
# print(f"idx {msg.esc_index}, rpm: {msg.rpm}")
221153
print(dronecan.to_yaml(msg))
222154

223155
def set_rpm(self, esc_index, rpm):

0 commit comments

Comments
 (0)