-
Notifications
You must be signed in to change notification settings - Fork 0
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
Make simulation work with double mallet setup #277
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2b08646
Add collision to mallet_servo_box (was a warning)
iibrahimli 69d91c3
Use move group goal state for mallet_finger
iibrahimli 36759fc
Add TODO for tomorrow
iibrahimli 256f3f9
Merge branch 'main' of github.com:UHHRobotics22-23/marimbabot into fi…
iibrahimli 1214a2d
Fix 2nd mallet in Gazebo
iibrahimli 73cb1c0
Simulation working, add joints in the mallets for compliance
iibrahimli d1ecba2
add TODO
iibrahimli 2bb6a3f
add todo element
iibrahimli 1c45ae6
Change MIDI dir determination logic
iibrahimli 133c018
Change back homing interval
iibrahimli 4ec1918
Merge branch 'main' of github.com:UHHRobotics22-23/marimbabot into fi…
iibrahimli ceb63e0
Disable PlotJuggler by default
iibrahimli 1c77b8f
Finish readme for simulation
iibrahimli ef92162
Try fixing path
iibrahimli 7a85f3d
Fix path
iibrahimli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,59 @@ | ||
# Simulation package | ||
|
||
|
||
## Overview | ||
|
||
The simulation consists of a Gazebo world with a Marimbabot model, a node to detect contacts and generate MIDI, and optionally PlotJuggler to view contact velocities. The planning node is launched as well to allow the user to play the simulation using the action server. | ||
|
||
|
||
## Launch files | ||
|
||
There are the following launch files: | ||
|
||
* `marimbabot_gazebo.launch`: Launches the simulation in Gazebo. | ||
* `marimbabot_full_sim.launch`: Launches the simulation in Gazebo, as well as nodes to detect contacts and publish the contact points, and generate MIDI. | ||
* `marimbabot_full_sim.launch`: Launches the simulation in Gazebo, as well as nodes to detect contacts, publish the contact points, generate MIDI, and optionally launch PlotJuggler to view contact velocities. | ||
*This is the recommended launch file to use.* | ||
|
||
The PlotJuggler can be toggled on/off by setting the appropriate bool flag in the if block in the | ||
[the launch file](launch/marimbabot_full_sim.launch). | ||
|
||
|
||
## How to run | ||
|
||
First, make sure you have completed the steps in the [main README](../README.md) and therefore have a working environment. | ||
|
||
Launch the simulation with the following command: | ||
|
||
```bash | ||
roslaunch marimbabot_simulation marimbabot_full_sim.launch | ||
``` | ||
|
||
The MIDI file will be saved in the `marimbabot_simulation/midi` package folder with current datetime as name. | ||
The simulation can play any piece, and therefore needs to be fed a note string either manually using the action server, or using the `sound_pad.py` [script](../marimbabot_planning/scripts/sound_pad.py) in the `marimbabot_planning/scripts` package folder. E.g. to launch the Sound Pad script: | ||
|
||
```bash | ||
rosrun marimbabot_planning sound_pad.py | ||
``` | ||
|
||
|
||
## MIDI generation | ||
|
||
The simulation will record all bar hits (starting from the first hit to avoid a long silent interval in the beginning) and save them as a MIDI file in the `marimbabot_simulation/midi` package folder with current datetime as name. If the `marimbabot_simulation` directory cannot be found using `rospack find`, then the script falls back to the current directory. In any case, the MIDI directory will be logged to the output stream. | ||
|
||
The MIDI file can be played as follows: | ||
|
||
```bash | ||
fluidsynth /usr/share/sounds/sf2/FluidR3_GM.sf2 catkin_ws/src/marimbabot/marimbabot_simulation/midi/<FILENAME>.midi -a alsa | ||
``` | ||
fluidsynth /usr/share/sounds/sf2/FluidR3_GM.sf2 <PATH/TO/MIDI_FILE>.midi -a alsa | ||
``` | ||
|
||
In the above command, replace the path and `<FILENAME>` with the name of the MIDI file. | ||
|
||
To convert a MIDI file to MP3, use the following command template: | ||
|
||
```bash | ||
fluidsynth -l -T raw -F - /usr/share/sounds/sf2/FluidR3_GM.sf2 <PATH/TO/MIDI_FILE>.midi | twolame -b 256 -r - <NAME>.mp3 | ||
``` | ||
|
||
|
||
# TODO | ||
- [ ] Try tilting the mallet holder to make sure the second mallet hits the bar | ||
- [ ] detect_bar_contact: fix 2 notes hits at the same time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
marimbabot_ur5_flex_double_moveit_config/config/mallet_finger_controller.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
MalletHolder/trajectory_controller: | ||
type: effort_controllers/JointTrajectoryController | ||
joints: | ||
- mallet_finger | ||
gains: | ||
mallet_finger: { p: 100.0, d: 0.0, i: 10.0, i_clamp: 20.0 } | ||
constraints: | ||
goal_time: 0.6 | ||
stopped_velocity_tolerance: 0.05 | ||
mallet_finger: {trajectory: 0.1, goal: 0.01} | ||
stop_trajectory_duration: 0.5 | ||
state_publish_rate: 100 | ||
action_monitor_rate: 20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unused in the simulation btw