Skip to content

Commit

Permalink
Merge branch 'master' of github.com:CentraleNantesRobotics/ping360_so…
Browse files Browse the repository at this point in the history
…nar_python
  • Loading branch information
Stormix committed Jan 24, 2020
2 parents f1a4928 + bc8d7e4 commit e4cfd27
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
6 changes: 4 additions & 2 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@
"avatar_url": "https://avatars3.githubusercontent.com/u/56969577?v=4",
"profile": "https://github.com/tomlogan501",
"contributions": [
"ideas"
"ideas",
"test",
"bug"
]
}
],
"contributorsPerLine": 7,
"projectName": "ping360_sonar_python",
"projectName": "ping360_sonar",
"projectOwner": "CentraleNantesRobotics",
"repoType": "github",
"repoHost": "https://github.com",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Please report bugs and request features using the [Issue Tracker](https://github
<tr>
<td align="center"><a href="https://github.com/Hameck"><img src="https://avatars2.githubusercontent.com/u/14954732?v=4" width="100px;" alt=""/><br /><sub><b>Henrique Martinez Rocamora</b></sub></a><br /><a href="https://github.com/CentraleNantesRobotics/ping360_sonar/commits?author=Hameck" title="Code">💻</a> <a href="https://github.com/CentraleNantesRobotics/ping360_sonar/commits?author=Hameck" title="Tests">⚠️</a></td>
<td align="center"><a href="https://stormix.co"><img src="https://avatars2.githubusercontent.com/u/18377687?v=4" width="100px;" alt=""/><br /><sub><b>Anas Mazouni</b></sub></a><br /><a href="https://github.com/CentraleNantesRobotics/ping360_sonar/commits?author=Stormiix" title="Code">💻</a> <a href="https://github.com/CentraleNantesRobotics/ping360_sonar/commits?author=Stormiix" title="Tests">⚠️</a></td>
<td align="center"><a href="https://github.com/tomlogan501"><img src="https://avatars3.githubusercontent.com/u/56969577?v=4" width="100px;" alt=""/><br /><sub><b>tomlogan501</b></sub></a><br /><a href="#ideas-tomlogan501" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/tomlogan501"><img src="https://avatars3.githubusercontent.com/u/56969577?v=4" width="100px;" alt=""/><br /><sub><b>tomlogan501</b></sub></a><br /><a href="#ideas-tomlogan501" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/CentraleNantesRobotics/ping360_sonar/commits?author=tomlogan501" title="Tests">⚠️</a> <a href="https://github.com/CentraleNantesRobotics/ping360_sonar/issues?q=author%3Atomlogan501" title="Bug reports">🐛</a></td>
</tr>
</table>

Expand Down
28 changes: 15 additions & 13 deletions src/ping360_sonar/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,20 +139,22 @@ def main():

# Prepare scan msg
index = int(round((angle * 2 * pi / 400) / angle_increment))

# Get the first high intensity value
detectedIntensity = next((x for x in data if x >= threshold), None)
if detectedIntensity:
detectedIndex = data.index(detectedIntensity)
# The index+1 represents the number of samples which then can be used to deduce the range
distance = calculateRange(
(1 + detectedIndex), samplePeriod, speedOfSound)
if distance >= 0.75 and distance <= sonarRange:
ranges[index] = distance
intensities[index] = detectedIntensity
if debug:
print("Object at {} grad : {}m - intensity {}%".format(angle,
ranges[index],
float(intensities[index] * 100 / 255)))
for detectedIntensity in data:
if detectedIntensity >= threshold:
detectedIndex = data.index(detectedIntensity)
# The index+1 represents the number of samples which then can be used to deduce the range
distance = calculateRange(
(1 + detectedIndex), samplePeriod, speedOfSound)
if distance >= 0.75 and distance <= sonarRange:
ranges[index] = distance
intensities[index] = detectedIntensity
if debug:
print("Object at {} grad : {}m - intensity {}%".format(angle,
ranges[index],
float(intensities[index] * 100 / 255)))
break
# Contruct and publish Sonar scan msg
scanDataMsg = generateScanMsg(ranges, intensities, sonarRange, step)
laserPub.publish(scanDataMsg)
Expand Down

0 comments on commit e4cfd27

Please sign in to comment.