能否在Android Studio开发的Pepper应用中启动Choregraphe行为及相关影响咨询
Hey there! Let's tackle your two questions about Pepper app development with Android Studio and Choregraphe:
1. Can an Android Studio-built app (using Pepper SDK) launch a Choregraphe-developed behavior?
Absolutely! You can use the ALBehaviorManager class from the Pepper SDK to trigger Choregraphe behaviors directly from your Android app. Here's how it works:
First, grab an instance of ALBehaviorManager using your app's qiContext. Then call the runBehavior() method, passing either the full file path of the installed behavior (like /home/nao/.local/share/PackageManager/apps/YourCustomBehavior) or its unique package name.
Here's a quick code snippet to illustrate:
// Get the ALBehaviorManager instance ALBehaviorManager behaviorManager = new ALBehaviorManager(qiContext); try { // Launch your target Choregraphe behavior behaviorManager.runBehavior("com.yourcompany.yourbehavior"); } catch (Exception e) { // Handle errors (e.g., behavior not found, permission issues) e.printStackTrace(); }
A couple of key notes:
- Make sure your Android app has the required permission:
com.aldebaran.permission.BEHAVIOR_MANAGER(add this to your manifest). - Double-check that the target behavior is properly installed on Pepper and that you're using the correct path/package name.
2. What happens to existing installed behaviors on Pepper when running an app installed via Android Studio?
In most cases, running your Android app won't interfere with existing Choregraphe behaviors—unless you explicitly code it to do so. Here are the key scenarios to keep in mind:
- Resource conflicts: If your Android app requests control over a resource that a running Choregraphe behavior is using (like the camera, speaker, or robot limbs), Pepper's system will handle resource prioritization. For example, if your app takes over limb control, the running behavior might pause until your app releases that resource.
- Explicit behavior management: If your app uses
ALBehaviorManagermethods likestopAllBehaviors()orstopBehavior(), it will directly terminate running Choregraphe behaviors. But if you don't include such logic, existing behaviors will keep running as normal. - No automatic overwrites/deletions: Android apps and Choregraphe behaviors are stored in separate locations on Pepper (Android apps go to
/data/app/, behaviors to/home/nao/.local/share/PackageManager/apps/), so installing your Android app won't delete or overwrite any existing behaviors.
内容的提问来源于stack exchange,提问作者U.C

