Skip to content

Commit 337649b

Browse files
authored
Merge pull request #485 from robotemi/dev_sprint_135
Sprint 135
2 parents 7705723 + 3ac7d2e commit 337649b

File tree

12 files changed

+261
-33
lines changed

12 files changed

+261
-33
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ android.enableJetifier=true
2121
kotlin.code.style=official
2222

2323
GROUP=com.robotemi
24-
VERSION_NAME=1.134.1
24+
VERSION_NAME=1.135.1
2525
POM_URL=https://github.com/robotemi/sdk/
2626
POM_SCM_URL=https://github.com/robotemi/sdk/
2727
POM_SCM_CONNECTION=scm:git:git://github.com/robotemi/sdk.git

sample/src/main/java/com/robotemi/sdk/sample/MainActivity.kt

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ import com.robotemi.sdk.telepresence.LinkBasedMeeting
7272
import com.robotemi.sdk.telepresence.Participant
7373
import com.robotemi.sdk.tourguide.TourModel
7474
import com.robotemi.sdk.voice.ITtsService
75+
import com.robotemi.sdk.voice.WakeupOrigin
7576
import com.robotemi.sdk.voice.model.TtsVoice
7677
import kotlinx.android.synthetic.main.activity_main.*
7778
import kotlinx.android.synthetic.main.group_app_and_permission.*
@@ -331,6 +332,10 @@ class MainActivity : AppCompatActivity(), NlpListener, OnRobotReadyListener,
331332

332333
btnStopMovement.setOnClickListener { stopMovement() }
333334
btnFollow.setOnClickListener { followMe() }
335+
btnFollow.setOnLongClickListener {
336+
followMe(SpeedLevel.HIGH)
337+
true
338+
}
334339
btnskidJoy.setOnClickListener { skidJoy() }
335340
btnskidJoyDialog.setOnClickListener {
336341
val alert = AlertDialog.Builder(it.context)
@@ -470,6 +475,7 @@ class MainActivity : AppCompatActivity(), NlpListener, OnRobotReadyListener,
470475
mediaPlayer.reset()
471476
}
472477
btnSetGoToSpeed.setOnClickListener { setGoToSpeed() }
478+
btnSetFollowSpeed.setOnClickListener { setFollowSpeed() }
473479
btnSetGoToSafety.setOnClickListener { setGoToSafety() }
474480
btnToggleTopBadge.setOnClickListener { toggleTopBadge() }
475481
btnToggleDetectionMode.setOnClickListener { toggleDetectionMode() }
@@ -586,6 +592,7 @@ class MainActivity : AppCompatActivity(), NlpListener, OnRobotReadyListener,
586592
true
587593
}
588594
btnIsKioskModeOn.setOnClickListener { isKioskModeOn() }
595+
btnCurrentHomeScreenMode.setOnClickListener { currentHomeScreenMode() }
589596
btnEnabledLatinKeyboards.setOnClickListener { enabledLatinKeyboards() }
590597
btnGetSupportedKeyboard.setOnClickListener { getSupportedLatinKeyboards() }
591598
btnToggleGroundDepthCliff.setOnClickListener { toggleGroundDepthCliff() }
@@ -850,6 +857,10 @@ class MainActivity : AppCompatActivity(), NlpListener, OnRobotReadyListener,
850857
printLog("Is kiosk mode on: ${robot.isKioskModeOn()}")
851858
}
852859

860+
private fun currentHomeScreenMode() {
861+
printLog("Current home screen mode: ${robot.getHomeScreenMode()}")
862+
}
863+
853864
private fun toggleKiosk() {
854865
robot.setKioskModeOn(!robot.isKioskModeOn())
855866
}
@@ -1089,8 +1100,8 @@ class MainActivity : AppCompatActivity(), NlpListener, OnRobotReadyListener,
10891100
/**
10901101
* Simple follow me example.
10911102
*/
1092-
private fun followMe() {
1093-
robot.beWithMe()
1103+
private fun followMe(speedLevel: SpeedLevel? = null) {
1104+
robot.beWithMe(speedLevel)
10941105
hideKeyboard()
10951106
}
10961107

@@ -1298,9 +1309,9 @@ class MainActivity : AppCompatActivity(), NlpListener, OnRobotReadyListener,
12981309
robot.showTopBar()
12991310
}
13001311

1301-
override fun onWakeupWord(wakeupWord: String, direction: Int) {
1312+
override fun onWakeupWord(wakeupWord: String, direction: Int, origin: WakeupOrigin) {
13021313
// Do anything on wakeup. Follow, go to location, or even try creating dance moves.
1303-
printLog("onWakeupWord", "$wakeupWord, $direction")
1314+
printLog("onWakeupWord", "$wakeupWord, $direction, $origin")
13041315
}
13051316

13061317
override fun onTtsStatusChanged(ttsRequest: TtsRequest) {
@@ -1634,6 +1645,29 @@ class MainActivity : AppCompatActivity(), NlpListener, OnRobotReadyListener,
16341645
dialog.show()
16351646
}
16361647

1648+
private fun setFollowSpeed() {
1649+
if (requestPermissionIfNeeded(Permission.SETTINGS, REQUEST_CODE_NORMAL)) {
1650+
return
1651+
}
1652+
printLog("Current follow speed ${robot.getFollowSpeed()}")
1653+
val speedLevels: MutableList<String> = ArrayList()
1654+
speedLevels.add(SpeedLevel.HIGH.value)
1655+
speedLevels.add(SpeedLevel.MEDIUM.value)
1656+
speedLevels.add(SpeedLevel.SLOW.value)
1657+
val adapter = ArrayAdapter(this, R.layout.item_dialog_row, R.id.name, speedLevels)
1658+
val dialog = AlertDialog.Builder(this)
1659+
.setTitle("Select Follow Speed Level")
1660+
.setAdapter(adapter, null)
1661+
.create()
1662+
dialog.listView.onItemClickListener =
1663+
OnItemClickListener { _: AdapterView<*>?, _: View?, position: Int, _: Long ->
1664+
val resp = robot.setFollowSpeed(SpeedLevel.valueToEnum(adapter.getItem(position)!!))
1665+
printLog("Set follow speed to: ${adapter.getItem(position)}, response $resp")
1666+
dialog.dismiss()
1667+
}
1668+
dialog.show()
1669+
}
1670+
16371671
private fun setGoToSafety() {
16381672
if (requestPermissionIfNeeded(Permission.SETTINGS, REQUEST_CODE_NORMAL)) {
16391673
return

sample/src/main/java/com/robotemi/sdk/sample/MapActivity.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,11 @@ class MapActivity : AppCompatActivity() {
111111
val internalFiles = internalMapDirectory.listFiles()?.toList() ?: listOf()
112112
val externalFiles = externalMapDirectory.listFiles()?.toList() ?: listOf()
113113
val files = (internalFiles + externalFiles).filter {
114-
it.isFile && it.path.endsWith("tar.gz", true)
114+
it.isFile
115+
&& (it.path.endsWith("tar.gz", true)
116+
|| it.path.endsWith("zip", true)
117+
|| it.path.endsWith("tgz", true)
118+
|| it.path.endsWith("tar", true))
115119
}
116120

117121
val builder = AlertDialog.Builder(this@MapActivity)

sample/src/main/java/com/robotemi/sdk/sample/TemiBroadcastReceiver.kt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import com.robotemi.sdk.SttLanguage
99
import com.robotemi.sdk.SttRequest
1010
import com.robotemi.sdk.TtsRequest
1111
import com.robotemi.sdk.constants.SequenceCommand
12+
import com.robotemi.sdk.navigation.model.Position
13+
import com.robotemi.sdk.voice.WakeupRequest
1214

1315
class TemiBroadcastReceiver : BroadcastReceiver() {
1416
companion object {
@@ -23,6 +25,7 @@ class TemiBroadcastReceiver : BroadcastReceiver() {
2325
private const val ACTION_MEETING = "temi.debug.meeting"
2426
private const val ACTION_FACE = "temi.debug.face"
2527
private const val ACTION_WAKE_UP = "temi.debug.wakeup"
28+
private const val ACTION_GOTO = "temi.debug.goto"
2629
}
2730

2831
override fun onReceive(context: Context?, intent: Intent?) {
@@ -168,8 +171,24 @@ class TemiBroadcastReceiver : BroadcastReceiver() {
168171
)
169172
15 -> Robot.getInstance().wakeup(listOf(SttLanguage.MS_MY, SttLanguage.RU_RU, SttLanguage.VI_VN))
170173
16 -> Robot.getInstance().wakeup(listOf(SttLanguage.EL_GR))
174+
17 -> Robot.getInstance().wakeup(listOf(SttLanguage.EL_GR), WakeupRequest(wakeupResponse = false))
175+
18 -> Robot.getInstance().wakeup(listOf(SttLanguage.EL_GR), WakeupRequest(wakeupResponse = true))
176+
}
177+
}
178+
ACTION_GOTO -> {
179+
// adb shell am broadcast -a temi.debug.sdk --es action "temi.debug.goto" --ei test 1
180+
val test = intent.getIntExtra("test", 1)
181+
val robot = Robot.getInstance()
182+
val position = robot.getPosition()
183+
when (test) {
184+
1 -> robot.goToPosition(position.copy(x = position.x + 0.5f))
185+
2 -> robot.goToPosition(position.copy(x = position.x + 0.5f), highAccuracyArrival = true)
186+
3 -> robot.goToPosition(position.copy(x = position.x + 0.5f, yaw = 999f), highAccuracyArrival = true)
187+
4 -> robot.goTo("a")
188+
5 -> robot.goTo("a", highAccuracyArrival = true)
189+
6 -> robot.goTo("a", highAccuracyArrival = true, noRotationAtEnd = true)
190+
7 -> robot.goTo("a", noRotationAtEnd = true)
171191
}
172-
173192
}
174193
}
175194
}

sample/src/main/res/layout/group_app_and_permission.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,9 @@
4949
style="@style/ButtonCommon"
5050
android:text="Is Kiosk Mode On" />
5151

52+
<Button
53+
android:id="@+id/btnCurrentHomeScreenMode"
54+
style="@style/ButtonCommon"
55+
android:text="Current Home Screen Mode" />
56+
5257
</LinearLayout>

sample/src/main/res/layout/group_settings_and_status.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,11 @@
218218
style="@style/ButtonCommon"
219219
android:text="Enable Hard Buttons" />
220220

221+
<Button
222+
android:id="@+id/btnSetFollowSpeed"
223+
style="@style/ButtonCommon"
224+
android:text="Set Follow Speed" />
225+
221226
<Button
222227
android:id="@+id/btnSetGoToSpeed"
223228
style="@style/ButtonCommon"

sdk/src/main/aidl/com/robotemi/sdk/ISdkService.aidl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import android.content.pm.ActivityInfo;
55
import com.robotemi.sdk.ISdkServiceCallback;
66
import com.robotemi.sdk.SttRequest;
77
import com.robotemi.sdk.TtsRequest;
8+
import com.robotemi.sdk.voice.WakeupRequest;
89
import com.robotemi.sdk.DisplayListRequest;
910
import com.robotemi.sdk.activitystream.ActivityStreamObject;
1011
import com.robotemi.sdk.notification.AlertNotification;
@@ -96,7 +97,7 @@ interface ISdkService {
9697
*
9798
* @param location - Saved location name.
9899
*/
99-
void goTo(in String location, int backwards, int noBypass, in String speedLevel);
100+
void goTo(in String location, int backwards, int noBypass, in String speedLevel, int highAccuracyArrival, int noRotationAtEnd);
100101

101102
/**
102103
* Retrieve list of previously saved locations.
@@ -122,7 +123,7 @@ interface ISdkService {
122123
/**
123124
* Request robot to follow the user.
124125
*/
125-
void beWithMe();
126+
void beWithMe(in String speedLevel);
126127

127128
void skidJoy(in float x, in float y, in boolean smart);
128129

@@ -174,7 +175,7 @@ interface ISdkService {
174175
*/
175176
boolean deleteLocation(in String name);
176177

177-
void wakeup(in int[] languages, in SttRequest sttRequest);
178+
void wakeup(in int[] languages, in SttRequest sttRequest, in WakeupRequest wakeupRequest);
178179

179180
String getWakeupWord();
180181

@@ -247,7 +248,7 @@ interface ISdkService {
247248

248249
void playSequence(in String packageName, in String sequenceId, boolean withPlayer, int repeat);
249250

250-
void goToPosition(in Position position, int backwards, int noBypass, in String speedLevel);
251+
void goToPosition(in Position position, int backwards, int noBypass, in String speedLevel, int highAccuracyArrival);
251252

252253
MapDataModel getMapData(in String packageName);
253254

@@ -387,4 +388,10 @@ interface ISdkService {
387388
String deleteMapLayer(in String packageName, in String layerId, int layerCategory);
388389

389390
String getHardButtonStatus(in String packageName, int type);
391+
392+
String setFollowSpeed(in String packageName, in String speedLevel);
393+
394+
String getFollowSpeed();
395+
396+
String getHomeScreenMode(in String packageName);
390397
}

sdk/src/main/aidl/com/robotemi/sdk/ISdkServiceCallback.aidl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import com.robotemi.sdk.exception.SdkException;
1616

1717
interface ISdkServiceCallback {
1818

19-
boolean onWakeupWord(in String wakeupWord, in int direction);
19+
boolean onWakeupWord(in String wakeupWord, in int direction, in String origin);
2020

2121
boolean onTtsStatusChanged(in TtsRequest ttsRequest);
2222

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.robotemi.sdk.voice;
2+
3+
parcelable WakeupRequest;

0 commit comments

Comments
 (0)