-
Notifications
You must be signed in to change notification settings - Fork 21
feat(shell): reintroduce ros.plugin.sh
#757
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
Merged
Merged
Changes from all commits
Commits
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 hidden or 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 hidden or 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,101 @@ | ||
| ### Aliases and functions for ROS 2 and colcon usage. | ||
|
|
||
| rid() { | ||
| export ROS_DOMAIN_ID="$1" | ||
| echo "ROS_DOMAIN_ID set to $ROS_DOMAIN_ID" | ||
| } | ||
|
|
||
| # Create a function to update the argcomplete and generate the completion | ||
| # scripts so that tab completion works within `pixi shell` environments. | ||
| update_argcompletes() { | ||
| local tools=( | ||
| ros2 | ||
| colcon | ||
| ) | ||
|
|
||
| if [[ -n "${CONDA_PREFIX:-}" ]]; then | ||
| local completions_path="$CONDA_PREFIX/share/zsh/site-functions" | ||
|
|
||
| if ! [[ -d "$completions_path" ]]; then | ||
| mkdir -p "$completions_path" | ||
| fi | ||
|
|
||
| for tool in "${tools[@]}"; do | ||
| if type "$tool" &> /dev/null; then | ||
| local _completion="$(register-python-argcomplete "$tool")" | ||
|
|
||
| if ! [[ -f "$completions_path/_$tool" ]]; then | ||
| echo "_completion" > "$completions_path/_$tool" | ||
| fi | ||
| fi | ||
| done | ||
| fi | ||
| } | ||
|
|
||
| setup_alises() { | ||
texhnolyze marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # check if we are in subdir of $ROS_WORKSPACE and switch to it otherwise | ||
| alias cdc='[[ "$PWD" = "$ROS_WORKSPACE"* ]] || cd "$ROS_WORKSPACE"' | ||
|
|
||
| alias psh='cdc && pixi shell' | ||
|
|
||
| # ros aliases | ||
| alias ros2='cdc && pixi run ros2' | ||
| alias rr='ros2 run' | ||
| alias rl='ros2 launch' | ||
|
|
||
| alias rte='ros2 topic echo' | ||
| alias rtl='ros2 topic list' | ||
| alias rth='ros2 topic hz' | ||
| alias rtp='ros2 topic pub' | ||
|
|
||
| alias rpl='ros2 param list' | ||
| alias rpg='ros2 param get' | ||
|
|
||
| # colcon aliases | ||
| alias colcon='cdc && pixi run colcon' | ||
| alias cba='cdc && pixi run build' | ||
| alias cbs='cba --packages-select' | ||
| alias cb='cba --packages-up-to' | ||
|
|
||
| alias ct='pixi run test' | ||
| alias cts='ct --packages-select' | ||
|
|
||
| alias cca='pixi run clean' | ||
|
|
||
| # deploy_robots tool aliases | ||
| alias dp='pixi run deploy --sync --build --print-bit-bot' | ||
| alias dpfull='dp --install --configure' | ||
| alias dpclean='dp --clean' | ||
| alias dplo='dp --skip-local-repo-check' | ||
|
|
||
| # Overwrite some aliases in pixi shell to allow for tab completion | ||
| # by directly using ros2/colcon instead of the pixi tasks | ||
| if [[ "$(ps -o comm= -p "$PPID")" == "pixi" ]]; then | ||
| alias cdc='cd $PIXI_PROJECT_ROOT' | ||
|
|
||
| # ros aliases | ||
| unalias ros2 | ||
| alias rr='ros2 run' | ||
| alias rl='ros2 launch' | ||
|
|
||
| alias rte='ros2 topic echo' | ||
| alias rtl='ros2 topic list' | ||
| alias rth='ros2 topic hz' | ||
| alias rtp='ros2 topic pub' | ||
|
|
||
| alias rpl='ros2 param list' | ||
| alias rpg='ros2 param get' | ||
|
|
||
| # colcon aliases | ||
| unalias colcon | ||
| alias cba='cdc && colcon build --symlink-install --cmake-args -G "Unix Makefiles" --continue-on-error' | ||
| alias cbs='cba --packages-select' | ||
| alias cb='cba --packages-up-to' | ||
|
|
||
| alias ct='cdc && colcon test --event-handlers console_direct+ --return-code-on-test-failure' | ||
| alias cts='ct --packages-select' | ||
| fi | ||
| } | ||
|
|
||
| update_argcompletes | ||
| setup_alises | ||
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.
Uh oh!
There was an error while loading. Please reload this page.