ShareShortcuts

Navigate with OpenPilot

twilsonco
„Navigate with OpenPilot“ forken

Hast du auf Basis dieses Kurzbefehls etwas Neues erstellt? Teile ihn als Fork: Er wird zu deinem eigenen Kurzbefehl, den du selbst verwaltest, und beide Seiten verlinken aufeinander, damit twilsonco die Anerkennung erhält.

  1. 1Lade den Kurzbefehl und ändere ihn in der Kurzbefehle-App. Gib ihm einen eigenen Namen.
  2. 2Teile ihn in der Kurzbefehle-App und kopiere den iCloud-Link.
  3. 3Komm hierher zurück, füge den Link ein und beschreibe, was sich geändert hat, z. B. „Einen Schritt hinzugefügt, der Apple Intelligence nutzt, um den Text zu personalisieren.“
Downloads
26K
Gesichert
0
Aktionen
161
Kategorie
Travel and Maps
Version
1.0
Sprache
EN

Vorschau

OpenPilot 🔗 Siri Shortcuts 🔗

OpenPilot is self-driving car software that's compatible with 250+ cars. You can make your existing car self-driving for around $1500. See comma.ai for more info.

This is a set of iOS (and macOS) Shortcuts that let you quickly set the OpenPilot navigation 🔗 destination from your iPhone, hands-free or not.

Report issues here using feedback, or on my GitHub

  • Users with Comma Prime subscriptions: The Comma Connect API can be used to easily set the navigation destination on your Comma device
  • Users without Comma Prime subscriptions: these shortcuts can still be used by making the API calls directly to your Comma device's IP address using
    • An external data hotspot that supports local networking, or
    • The Comma device's own hotspot, where you have your own sim card for data
    • The OpenPilot code must be changed to enable this:
    • This commit on GitHub 🔗 for the changes necessary to use navigation without a Comma Prime subscription, and
    • This commit 🔗 for the followup changes to enable use of these shortcuts

Here are Siri Shortcuts that provide the following functions for iPhone, iPad, and Mac users.

  1. Navigate with OpenPilot: Set OpenPilot navigation destination from a specified location/pin in Apple Maps, Google Maps, or Waze using the share sheet 🔗
  2. OpenPilot Search: Search for and select destinations
    • by saying "(Hey) Siri, OpenPilot search" or
    • by tapping the shortcut/widget/home screen icon followed by your destination (after the prompt)
  3. Go to work — Go home
    • by saying "(Hey) Siri, OpenPilot go to work" or
    • by saying "(Hey) Siri, OpenPilot go home", or
    • by tapping the shortcut/widget/home screen icon
  4. Go to favorite by saying "(Hey) Siri, OpenPilot go to favorite", then selecting a favorite from the list by voice or by tapping
  5. Go to recent by saying "(Hey) Siri, OpenPilot go to recent", then selecting one of the recent locations in the list
  6. Go to next event by saying "(Hey) Siri, OpenPilot go to next event", then perhaps selecting one of the recent locations in the list

Installation

  1. Acquire a JWT authentication 🔗 token at jwt.comma.ai 🔗, where you'll login using the same method you use at Comma Connect

  2. Go to Comma Connect 🔗 or UserAdmin 🔗 to get your Comma device dongle id (16 hex characters)

  3. Download and install the OpenPilot Siri Shortcuts by tapping the following links on your iPhone, iPad, or Mac

  4. Run all shortcuts immediately to acquire permissions and enable hands-free use on subsequent runs

  5. If Siri will not recognize the word "OpenPilot" when you speak, you can "teach" it the word by adding a new contact called OpenPilot, and by specifying a phonetic name for it

Navigate with OpenPilot

  • This is the main shortcut that actually performs the API call 🔗. This shortcut works in two ways, via the "Share Sheet" 🔗 and by being called by other shortcuts, providing a valid location as input.
  • To use with Apple Maps (see images):
    1. Tap the share button for a selected location/pin in Apple Maps
    2. Select "Navigate with OpenPilot" from the list of share actions
    3. If you don't see it in the list, or want it to appear higher for easier access, scroll down and select "edit actions"
    4. Tap the plus sign next to "Navigate with OpenPilot"
    5. Arrange the favorite actions to your liking
    6. That's it! You should see a notification indicating that navigation has been set on your Comma device, and directions will open automatically in Apple Maps
  • Google Maps: The process is identical, and directions will open in Google Maps
  • Waze: The process is similar
    1. Select a location, tap "Send", then "more options" to open the share sheet, then select "Navigate with OpenPilot"
    2. Finish starting directions in Waze
  • This shortcut takes text (for Waze), URLs (for Google Maps), and MapLinks (for Apple Maps) as input from the share sheet.
    • You can also run it from other shortcuts, such as in the other shortcuts provided here. This makes it very easy to extend the functionality.
    • If you do anything cool, be sure to let me know so it can be added here!

## OpenPilot search

- Voice search for locations, places or addresses, and choose from a visual + voice menu of results. Pick one and OpenPilot + iPhone navigation will start

  1. Four ways to use:
    1. Say "(Hey) Siri, OpenPilot search" , or
      • (becuase "OpenPilot search" is the name of the Shortcut, and every shortcut is callable by name automatically)
    2. Save the shortcut to a home/lock screen widget 🔗, or
    3. Save the shortcut as a home screen icon 🔗, or
    4. Tap the Shortcut in the Shortcuts app.
  2. Wait for the prompt "what text?"
    • ("what text?" was not my idea; you can't change the prompt; smh)
  3. Say the (mostly) complete address or location name without any long pauses
  4. You'll be presented with a list of results, and Siri will begin to read them. You can respond verbally or tap one of the results (even with CarPlay 🚗). Select one of the results or tap/say cancel to cancel.
  5. The default map app you specified during setup will open with directions to the destination, and you'll see a notification that navigation was set on your Comma device.

## Go home

- This simple shortcut lets you save one address

  • When run, it passes this location to the Navigate with OpenPilot Shortcut
  • Does not need to match the "home" address saved on Comma Connect

## Go to work

- Same Shortcut (as "Go home"), Different Destination

  • You see how these could be replicated to add more
  • Does not need to match the "work" address saved on Comma Connect

## Go to favorite

- Similar to home/work, but this one lets you specify multiple place names and locations

  • When run, you can select one of the favorites from the list, verbally or by tapping (even in CarPlay 🚗)
  • There is no set format to use for the specified locations
  • The specified locations are used to search, and the top result is used. They need to be complete enough that the desired place will be the top result

## Go to recent

- Similar to Go to favorites, but you'll choose from a list of recent locations

  • This shortcut just calls Navigate with OpenPilot without providing a location, causing it to run in recent location mode
  • Inspired by BitNotFound#5466 on Discord

## Go to next event

- This shortcut fetches your next calendar event that has a location specified, and sets OpenPilot and phone navigation to its location

Neue Funktionen

Version 1.0

First release

Versionsverlauf
1.0 9. Feb 2024

First release

Was er macht

161 Aktionen
  1. Set Variable
    Input address
  2. Comment
    Navigate with OpenPilot By Tim Wilson, November 2023 https://github.com/twilsonco/OpenPilotSiriShortcuts
  3. Comment
    Set JWT token for authenticating on comma’s server. Leave blank if using direct device access. See https://api.comma.ai/#authentication
  4. Text
  5. Comment
    Add one or more Comma device names (you pick) and dongle IDs. If more than one device is specified, you can set a default or have it ask every time. Get dongle id from comma connect https://connect.comma.ai or useradmin https://useradmin.comma.ai. L…
  6. Dictionary
  7. Get Dictionary Value
  8. Get Item from List
  9. Set Variable
    device name
  10. Text
  11. Set Variable
    map app name
  12. Count
  13. If
  14. Text
  15. If
  16. Choose from List
  17. Set Variable
    device name
  18. Get Dictionary Value
  19. Comment
    Enter the URL to use when making API calls. For Comma Prime users, leave the default. For direct device access, enter the device IP address with port 8082, e.g. 192.168.43.1:8082
  20. URL
    https://api.commadotai.com/v1/navigation
  21. Comment
    Check for shortcut updates
  22. Nothing
  23. Comment
    【Auto-Update Routine】 Checks For Latest Shortcut Version ↳ https://routinehub.co/shortcut/16590/
  24. Dictionary
  25. Get Dictionary Value
  26. If
  27. Get IP Address
  28. If
  29. Get Contents of URL
    https://routinehub.co/api/v1/shortcuts/…/versions/latest
  30. If
  31. Split Text
  32. Repeat with Each
  33. Calculate Expression
  34. Set Variable
    Latest Version
  35. Split Text
  36. Repeat with Each
  37. Calculate Expression
  38. Set Variable
    Current Version
  39. If
  40. Choose from Menu
    New Version: … Release: … Whats New: "…"
  41. Choose from Menu
    Update → Result (Version)
  42. Expand URL
  43. Replace Text
  44. Open URLs
  45. Stop This Shortcut
  46. Choose from Menu
    Skip (Info (Version))
  47. Comment
    【Auto-Update Routine Ends Here】 Support → https://www.reddit.com/r/shortcuts/comments/18j4f9p/ 【⚙️】 Convert Semantic Number to Decimals ↳ https://routinehub.co/shortcut/16589/
  48. Nothing
  49. Comment
    If no input provided, fetch recent locations and let user pick one
  50. If
  51. Number
  52. Get Contents of URL
    …/…/locations
  53. Dictionary
  54. Set Variable
    Recent locations dictionary
  55. Number
  56. Set Variable
    recent count
  57. Repeat with Each
  58. Match Text
  59. If
  60. If
  61. Text
  62. If
  63. Text
  64. If
  65. If
  66. Calculate
  67. Set Variable
    recent count
  68. Set Dictionary Value
  69. Set Variable
    Recent locations dictionary
  70. If
  71. Text
  72. Stop and Output
  73. Choose from List
  74. Text
  75. Location
  76. Set Variable
    Input address
  77. Comment
    For non-location input, from Apple/Google/Waze, parse the location
  78. Get Type
  79. If
  80. Comment
    Extract address if shared from Waze
  81. Match Text
  82. If
  83. Get URLs from Input
  84. Expand URL
  85. URL Encode
  86. Match Text
  87. If
  88. Get Group from Matched Text
  89. URL
    https://maps.apple.com/?q=…&ll=…
  90. Location
  91. Set Variable
    Input address
  92. If
  93. Get Addresses from Input
  94. Set Variable
    Input address
  95. Text
  96. Set Variable
    map app name
  97. If
  98. Comment
    Extract address if shared from google maps (url)
  99. Match Text
  100. If
  101. Get Group from Matched Text
  102. URL
  103. Expand URL
  104. URL Encode
  105. Match Text
  106. If
  107. Get Group from Matched Text
  108. Replace Text
  109. Get Addresses from Input
  110. Set Variable
    Input address
  111. Text
  112. Set Variable
    map app name
  113. If
  114. Match Text
  115. If
  116. Get Group from Matched Text
  117. Get Addresses from Input
  118. Set Variable
    Input address
  119. Text
  120. Set Variable
    map app name
  121. If
  122. Match Text
  123. If
  124. Get Group from Matched Text
  125. URL
    https://maps.apple.com/?q=…&ll=…
  126. Location
  127. Set Variable
    Input address
  128. If
  129. Location
  130. Set Variable
    Input address
  131. Location
  132. Set Variable
    Input address
  133. Location
  134. Get Details of Locations
  135. Get Details of Locations
  136. Get Details of Locations
  137. Get Details of Locations
  138. Get Details of Locations
  139. Get Details of Locations
  140. Get Details of Locations
  141. Get Details of Locations
  142. Text
  143. Comment
    https://api.comma.ai/#navigation
  144. Get Contents of URL
    …/…/set_destination
  145. Get Type
  146. If
  147. If
  148. List
  149. Change Case
  150. If
  151. Show Directions
  152. If
  153. Text
  154. Show Result
  155. Show Notification
    … nav set to: …
  156. Stop This Shortcut
  157. If
  158. If
  159. Show Notification
    …
  160. Stop This Shortcut
  161. Show Notification
    …

Als Code ansehen
Beta

Jede Aktion dieses Kurzbefehls als Cherri ausgeschrieben, eine Programmiersprache für Kurzbefehle. Ideal, um zu lernen, wie er funktioniert.

#include 'actions/web'
#include 'actions/network'
#define color darkblue
#define glyph map

@InputAddress = ShortcutInput
/*
Navigate with OpenPilot
By Tim Wilson, November 2023
https://github.com/twilsonco/OpenPilotSiriShortcuts

*/
// Set JWT token for authenticating on comma’s server. Leave blank if using direct device access. See https://api.comma.ai/#authentication

const JWTToken = ""
/*
Add one or more Comma device names (you pick) and dongle IDs. If more than one device is specified, you can set a default or have it ask every time. 
Get dongle id from comma connect https://connect.comma.ai or useradmin https://useradmin.comma.ai.
Leave blank for direct access
*/
const DongleIdDict = {
	"C3": "0000000000000000"
}
const DeviceNameList = getValue(DongleIdDict, "")
@DeviceName = getFirstItem(DeviceNameList)
@MapAppName = "Maps"
const Count = count(@DeviceName)

if Count > 1 {
	const AskUser = "yes"
	if AskUser == "yes" {
		chooseFromList(DeviceNameList)
		@DeviceName
	}
}
const DongleId = DongleIdDict[@DeviceName]
// Enter the URL to use when making API calls. For Comma Prime users, leave the default. For direct device access, enter the device IP address with port 8082, e.g. 192.168.43.1:8082

const APIUrl = url("https://api.commadotai.com/v1/navigation")
// Check for shortcut updates

nothing()
/*
【Auto-Update Routine】
Checks For Latest Shortcut Version
↳ https://routinehub.co/shortcut/16590/
*/
const Info = {
	"Author": "twilsonco",
	"RoutineHub ID": 17677,
	"Version": "1.0.1",
	"Version Check": true
}
const True = getValue(Info, "Version Check")

if True == "Yes" {
	const CurrentIPAddress = getExternalIP("IPv4")
	if CurrentIPAddress {
		const Result = downloadURL("https://routinehub.co/api/v1/shortcuts/{Info['RoutineHub ID']}/versions/latest")
		if Result contains "success" {
			const SplitText = splitText(Result['Version'], ".")
			for _ in SplitText {
				@LatestVersion = ((1/1000)^@RepeatIndex)*@RepeatItem+@LatestVersion
			}
			const SplitText1 = splitText(Info['Version'], ".")
			for _ in SplitText1 {
				@CurrentVersion = ((1/1000)^@RepeatIndex)*@RepeatItem+@CurrentVersion
			}
			if @LatestVersion > @CurrentVersion {
				menu "New Version: {Result['Version']}\nRelease: {Result['Release']}\nWhats New: \"{Result['Notes']}\"" {
				item "Update → {Result['Version']}":
					expandURL(Result['URL'])
					const UpdatedText = replaceText("https://www.icloud.com/", "shortcuts://", false)
					openURL(UpdatedText)
					stop()
				item "Skip ({Info['Version']})":
				}
			}
		}
	}
}
/*
【Auto-Update Routine Ends Here】
Support → https://www.reddit.com/r/shortcuts/comments/18j4f9p/

【⚙️】
Convert Semantic Number to Decimals
↳ https://routinehub.co/shortcut/16589/
*/
nothing()
// If no input provided, fetch recent locations and let user pick one


if !@InputAddress {
	const MaxNumRecents = 10
	const ContentsOfURL = jsonRequest("{APIUrl}/{DongleId}/locations", "GET", {}, {
		"Authorization": "JWT {JWTToken}"
	})
	@RecentLocationsDictionary = {}
	@RecentCount = 0
	for _ in ContentsOfURL {
		const Matches = containsText(@RepeatItem['save_type'], "recent")
		if Matches {
			if @RepeatItem {
			} else {
			}
			if @RecentLocationsDictionary != PlaceKey {
				if @RecentCount < MaxNumRecents {
					@RecentCount = @RecentCount + 1
					@RecentLocationsDictionary = setValue(@RecentLocationsDictionary, PlaceKey, @RepeatItem)
				}
			}
		}
	}
	if @RecentCount == 0 {
		mustOutput()
	}
	chooseFromList(@RecentLocationsDictionary)
	const Text = "{['place_name']}, {['place_details']}"
	location(Text)
	@InputAddress
}
// For non-location input, from Apple/Google/Waze, parse the location

const Type = typeOf(@InputAddress)

if Type != "Location" {
	// Extract address if shared from Waze

	const Matches1 = containsText(@InputAddress, "Use Waze*")
	if Matches1 {
		getURLs(@InputAddress)
		expandURL()
		const URLEncodedText = urlEncode()
		const Matches2 = containsText(URLEncodedText, ".*ll\.([^&]+)")
		if Matches2 {
			getMatchGroup(Matches2, 0)
			const URL = url("https://maps.apple.com/?q={}&ll={}")
			location(URL)
			@InputAddress
		} else {
			getAddresses(URLEncodedText)
			@InputAddress
		}
		@MapAppName = "Waze"
	} else {
		// Extract address if shared from google maps (url)

		const Matches3 = containsText(@InputAddress, "(http\S+)")
		if Matches3 {
			const Text1 = getMatchGroup(Matches3, 0)
			const URL2 = url(Text1)
			expandURL(URL2)
			urlEncode()
			const Matches4 = containsText(, ".*goo.*q=([^&]*)")
			if Matches4 {
				getMatchGroup(Matches4, 0)
				const UpdatedText1 = replaceText("+", " ")
				getAddresses(UpdatedText1)
				@InputAddress
				@MapAppName = "Google Maps"
			} else {
				const Matches5 = containsText(, ".*apple.*address=([^&]*)")
				if Matches5 {
					const Text2 = getMatchGroup(Matches5, 0)
					getAddresses(Text2)
					@InputAddress
					@MapAppName = "Maps"
				} else {
					const Matches6 = containsText(Text1, ".*apple.*ll=([^&]*)")
					if Matches5 {
						getMatchGroup(Matches6, 0)
						const URL1 = url("https://maps.apple.com/?q={}&ll={}")
						location(URL1)
						@InputAddress
					} else {
						location(URL2)
						@InputAddress
					}
				}
			}
		}
	}
	location(@InputAddress)
	@InputAddress
}
const Location = location(@InputAddress)
getLocationDetail(Location, "Name")
getLocationDetail(Location, "Street")
getLocationDetail(Location, "City")
getLocationDetail(Location, "State")
getLocationDetail(Location, "ZIP Code")
getLocationDetail(Location, "Country")
getLocationDetail(Location, "Latitude")
getLocationDetail(Location, "Longitude")
const PlaceDetails = "{}, {}, {} {}, {}"
// https://api.comma.ai/#navigation

const ContentsOfURL1 = jsonRequest("{APIUrl}/{DongleId}/set_destination", "POST", {
	"latitude": "{}",
	"longitude": "{}",
	"place_details": "{PlaceDetails}",
	"place_name": "{}"
}, {
	"Authorization": "JWT {JWTToken}",
	"Content-Type": "application/json"
})
const Type1 = typeOf(ContentsOfURL1)

if Type1 == "Dictionary" {
	if ContentsOfURL1['Keys'] contains "success" {
		const AllowedMapAppNames = list("Maps", "Google Maps", "Waze")
		const MapAppNameTitleCase = uppercase(@MapAppName)
		if AllowedMapAppNames contains MapAppNameTitleCase {
			rawAction("is.workflow.actions.getdirections", {
				"WFDestination": "@InputAddress",
				"WFGetDirectionsActionApp": "MapAppNameTitleCase"
			})
		} else {
			show()
		}
		showNotification("{@DeviceName} nav set to: {@InputAddress}", "", false, @InputAddress)
		stop()
	} else {
		if ContentsOfURL1['Keys'] contains "error" {
			showNotification(ContentsOfURL1['error'], "Error setting destination", ContentsOfURL1)
			stop()
		}
	}
}
showNotification(ContentsOfURL1, "Error setting destination")
Mit cherri 2.3.0 (GPL-2.0) dekompiliert. Eventuell sind kleine Korrekturen nötig, bevor es kompiliert wird.

Bewertungen und Rezensionen

Rezension schreiben
–
von 5
★★★★★
★★★★
★★★
★★
★
0 ratings

No reviews yet. Be the first to share what you think!

Werbung

Mehr von twilsonco

Alle anzeigen

Das gefällt dir vielleicht auch

Alle anzeigen
Werbung