Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #641 #669

Merged
merged 5 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions vrx_gz/src/vrx_gz/bridges.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,6 @@ def cmd_vel(model_name):
ros_type='geometry_msgs/msg/Twist',
direction=BridgeDirection.ROS_TO_GZ)

def acoustic_pinger(model_name):
return Bridge(
gz_topic=f'{model_name}/pingers/pinger/range_bearing',
ros_topic=f'pingers/pinger/range_bearing',
gz_type='ignition.msgs.Param',
ros_type='ros_gz_interfaces/msg/ParamVec',
direction=BridgeDirection.GZ_TO_ROS)

def set_acoustic_pinger(model_name):
return Bridge(
gz_topic=f'{model_name}/pingers/pinger/set_pinger_position',
ros_topic=f'pingers/pinger/set_pinger_position',
gz_type='ignition.msgs.Vector3d',
ros_type='geometry_msgs/msg/Vector3',
direction=BridgeDirection.ROS_TO_GZ)

def comms_tx(model_name):
return Bridge(
gz_topic='/broker/msgs',
Expand Down
6 changes: 1 addition & 5 deletions vrx_gz/src/vrx_gz/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,7 @@ def bridges(self, world_name):
vrx_gz.bridges.cmd_vel(self.model_name)
])
elif self.is_USV():
bridges.extend([
# Acoustic pinger
vrx_gz.bridges.acoustic_pinger(self.model_name),
vrx_gz.bridges.set_acoustic_pinger(self.model_name),
])
pass

return [bridges, nodes, custom_launches]

Expand Down
21 changes: 21 additions & 0 deletions vrx_gz/src/vrx_gz/payload_bridges.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,22 @@ def thrust_joint_pos(model_name, side):
ros_type='std_msgs/msg/Float64',
direction=BridgeDirection.ROS_TO_GZ)

def acoustic_pinger(model_name):
return Bridge(
gz_topic=f'{model_name}/pingers/pinger/range_bearing',
ros_topic=f'pingers/pinger/range_bearing',
gz_type='ignition.msgs.Param',
ros_type='ros_gz_interfaces/msg/ParamVec',
direction=BridgeDirection.GZ_TO_ROS)

def set_acoustic_pinger(model_name):
return Bridge(
gz_topic=f'{model_name}/pingers/pinger/set_pinger_position',
ros_topic=f'pingers/pinger/set_pinger_position',
gz_type='ignition.msgs.Vector3d',
ros_type='geometry_msgs/msg/Vector3',
direction=BridgeDirection.ROS_TO_GZ)

def payload_bridges(world_name, model_name, link_name, sensor_name, sensor_type):
bridges = []
if sensor_type == sdf.Sensortype.CAMERA:
Expand Down Expand Up @@ -203,5 +219,10 @@ def payload_bridges(world_name, model_name, link_name, sensor_name, sensor_type)
bridges = [
thrust_joint_pos(model_name, sensor_type),
]
elif 'AcousticPinger' in sensor_name:
bridges = [
acoustic_pinger(model_name),
set_acoustic_pinger(model_name),
]

return bridges
8 changes: 7 additions & 1 deletion vrx_urdf/wamv_gazebo/urdf/components/wamv_pinger.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
<link name="${namespace}/${name}">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<sphere radius="0.01" />
</geometry>
</visual>
<inertial>
<mass value="0.1"/>
<inertia ixx="0.00000542" ixy="0.0" ixz="0.0" iyy="0.00002104" iyz="0.0" izz="0.00002604"/>
</inertial>
</link>
<joint name="${namespace}/${name}_pinger_joint" type="fixed">
<joint name="${namespace}/${name}_pinger_joint" type="revolute">
<axis xyz="0 0 1"/>
<limit effort="1000.0" lower="0.0" upper="0" velocity="0"/>
<origin xyz="0 0 0" rpy="0 0 0" />
<parent link="${namespace}/base_link"/>
<child link="${namespace}/${name}"/>
</joint>
Expand Down