self.pub_range_fwd_left = rospy.Publisher("range_forward_left", Range, queue_size=16)
self.pub_range_fwd_right = rospy.Publisher("range_forward_right", Range, queue_size=16)
self.pub_range_bwd = rospy.Publisher("range_backward", Range, queue_size=16)
- self.pub_range_left = rospy.Publisher("range_left", Range, queue_size=16)
- self.pub_range_right = rospy.Publisher("range_right", Range, queue_size=16)
self.pub_battery = rospy.Publisher("battery", BatteryState, queue_size=16)
self.cmd_vel = None
self.cur_vel = (0, 0)
msg.range = dist
pub.publish(msg)
- def get_dist_left(self):
- if self.pub_range_left.get_num_connections() > 0:
- dist = self.get_dist_ir(0x1)
- if dist > -67:
- self.send_range(self.pub_range_left, "ir_left", Range.INFRARED, 30.553/(dist - -67.534), 0.04, 0.3, 1)
-
- def get_dist_right(self):
- if self.pub_range_right.get_num_connections() > 0:
- dist = self.get_dist_ir(0x3)
- if dist > 69:
- self.send_range(self.pub_range_right, "ir_right", Range.INFRARED, 17.4/(dist - 69), 0.04, 0.3, 1)
-
def get_dist_forward_left(self):
if self.pub_range_fwd_left.get_num_connections() > 0:
dist = self.read_dist_srf(0x15)
<xacro:range_sensor name="sonar_forward_left" ros_topic="range_forward_left" update_rate="10" minRange="0.04" maxRange="0.5" fov="${20*PI/180}" radiation="ultrasound" />
<xacro:range_sensor name="sonar_forward_right" ros_topic="range_forward_right" update_rate="10" minRange="0.04" maxRange="0.5" fov="${20*PI/180}" radiation="ultrasound" />
<xacro:range_sensor name="sonar_backward" ros_topic="range_backward" update_rate="10" minRange="0.04" maxRange="0.5" fov="${20*PI/180}" radiation="ultrasound" />
- <xacro:range_sensor name="ir_left" ros_topic="range_left" update_rate="10" minRange="0.04" maxRange="0.3" fov="${5*PI/180}" radiation="infrared" />
- <xacro:range_sensor name="ir_right" ros_topic="range_right" update_rate="10" minRange="0.04" maxRange="0.3" fov="${5*PI/180}" radiation="infrared" />
<gazebo reference="lidar">
<sensor type="ray" name="head_rplidar_a2_sensor">