New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 685530 link

Starred by 0 users

Issue metadata

Status: Archived
Owner:
Closed: Jul 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Feature



Sign in to add a comment

Chameleon: Add motor control support and API

Project Member Reported by cychiang@chromium.org, Jan 26 2017

Issue description

There are 5 motors to control, each has 3 pins: Step, Direction, Enable.

https://docs.google.com/spreadsheets/d/1yQGW4z16llKE97vSVqXBPoxU88oGL74FN9qiye4XXmo/edit#gid=0

I will add the support in chameleond.
The tricky part is that we need to share some pin with jack plugger.
We need a way to tell chameleond which config it is using.
Since we don't have many setup for motor, an easy way is to add a tag file for those chameleon that controls motors.




 
Labels: OS-Chrome
Uploaded two WIP CLs.

remote:   https://chromium-review.googlesource.com/433620 WIP: add module to control motor for button automation        
remote:   https://chromium-review.googlesource.com/433621 WIP: expose API to control button automation

Still, it will be better if we can let chameleon detect whether there is motor connected or not. Not sure if that is possible.
Jimmy,

Regarding number of setups... 
To start with, we will need about 10 setups for Jabra speaker and 4 for Atrus. 

Comment 4 by eddych@chromium.org, Jan 29 2017

Wow.  That's 14 setups to start with.  Then it is worth the effort to design/layout a new board for this purpose.  Currently we only have a hand soldered board for proof of concept.

I'll investigate how to relay the I2C signals and power from the audio board to the new board, and use new I/O expander for this function.  Plan to use the same board dimension as the current FPGA, video, and audio board, so we can stack underneath the audio board.
Thank you Harpreet and Eddy.
Per discussion in https://docs.google.com/spreadsheets/d/1yQGW4z16llKE97vSVqXBPoxU88oGL74FN9qiye4XXmo/edit#gid=0 , we will use new I2C address, so we don't need to share the GPIO with jack plugger.
That makes things easier in software.
Thanks!
We got the board today.
I will modify the patch for new I2C addresses, and verify the function with Eddy this week, ETA Friday.
Thanks Jimmy / Eddy!
With the two CLs:
remote:   https://chromium-review.googlesource.com/433620 motor_board: Add motor board module to control motor for button automation        
remote:   https://chromium-review.googlesource.com/433621 fpga_tio: Expose API to control motor for button automation

I can control the motors using Chameleon test_server.py like:

>>> for _ in xrange(10):                                                                                                                                                                                     
...   p.MotorTouch('Vol Down')                                                                                                                                                                               
...   p.MotorRelease('Vol Down')

Video: https://drive.google.com/open?id=0B8wq2Jyx2rnGbW4wNk4zU0ZXUGs


Things TODO:

1. Add mechanism to reset motor to a fixed position.
2. Adjust the moving range when it is mounted on the holder.

Since there are two types of holders and speakers, we need to support two ranges.
The holder and speaker model are so tightly coupled, I would like to put this logic in Chameleond so client side can be simplified.
The API can be like:

p.MotorTouch('Vol Down', 'Atrus 1') # Query the table to get number of pulse for 'Atrus 1'
p.MotorRelease('Vol Down')   # Back to reset position.

3. Add client side library in autotest.

Comment 9 Deleted

Added a short document explaining the motor control hardware.  Has the links to the documents for the board and mechanical holder.

https://docs.google.com/a/google.com/document/d/1uz3RUIfhIBDm1a_F7jNx4JsDcAsRJFc6RP7NFo3OgAc/edit?usp=sharing
Project Member

Comment 11 by bugdroid1@chromium.org, Apr 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/chameleon/+/d0edbd33049739d9345f722488358f0a3dcf77b5

commit d0edbd33049739d9345f722488358f0a3dcf77b5
Author: Cheng-Yi Chiang <cychiang@chromium.org>
Date: Thu Apr 06 10:29:38 2017

motor_board: Add motor board module to control motor for button automation

The motor board has an I/O expander on I2C bus 3, offset 0x23.
We use it to control 5 motors for button automation.

The motor model is read from /etc/default/motor_model. Currently, there
are 'Atrus' and 'Jabra' models. The movement parameters are not tuned
yet.

BUG= chromium:685530 
TEST=verify motor function with the next CL.

Change-Id: Ib8829c4246a8b1b1b79c8dfe2b9bcf8ec661b170
Reviewed-on: https://chromium-review.googlesource.com/433620
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
Reviewed-by: Shyh-In Hwang <josephsih@chromium.org>

[add] https://crrev.com/d0edbd33049739d9345f722488358f0a3dcf77b5/chameleond/devices/motor_board.py
[modify] https://crrev.com/d0edbd33049739d9345f722488358f0a3dcf77b5/chameleond/utils/chameleon_io.py

Project Member

Comment 12 by bugdroid1@chromium.org, May 5 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/chameleon/+/7e54f8edfd2ee7ed145807d1a0169660fc3d7ae0

commit 7e54f8edfd2ee7ed145807d1a0169660fc3d7ae0
Author: Cheng-Yi Chiang <cychiang@chromium.org>
Date: Fri May 05 07:41:13 2017

Add IsDetected method to IoExpander and use it in audio board

To support IsDetected method on audio board, we need a way to check
whether audio board is connected to Chameleon.
Add a method IsDetect on IoExpander. Use that method to check whether
all IoExpanders used by audio board are connected.

BUG= chromium:685530 
TEST=run audio_AudioBasicHeadphone test

Change-Id: Icc8bf15915bfcf2d242fc9a4fcb7c800858e24bd
Reviewed-on: https://chromium-review.googlesource.com/494447
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
Reviewed-by: Hsu Wei-Cheng <mojahsu@chromium.org>

[modify] https://crrev.com/7e54f8edfd2ee7ed145807d1a0169660fc3d7ae0/chameleond/utils/chameleon_io.py
[modify] https://crrev.com/7e54f8edfd2ee7ed145807d1a0169660fc3d7ae0/chameleond/devices/audio_board.py

Project Member

Comment 13 by bugdroid1@chromium.org, May 5 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/chameleon/+/93a23133d5612dd5a86dcd8a9efb866ddd36d7d4

commit 93a23133d5612dd5a86dcd8a9efb866ddd36d7d4
Author: Cheng-Yi Chiang <cychiang@chromium.org>
Date: Fri May 05 10:11:01 2017

Implement device functions for motor board

Implement IsDetected, InitDevice, Reset for motor board.
Add motor board instance to fpga_tio.

To reset motor, move motor toward release direction for an excessive
distance such that it is fixed.

BUG= chromium:685530 
TEST=on test_server, runs p.motor_board.Touch(func) and
p.motor_board.Release(func), where func is one of ['Vol Up', 'Vol Down',
'Mute', 'Call', 'Hang Up']

Change-Id: I6b7d3f39df4d1feee93309c593b4759e02b5ff32
Reviewed-on: https://chromium-review.googlesource.com/479615
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@google.com>

[modify] https://crrev.com/93a23133d5612dd5a86dcd8a9efb866ddd36d7d4/chameleond/devices/motor_board.py
[modify] https://crrev.com/93a23133d5612dd5a86dcd8a9efb866ddd36d7d4/chameleond/drivers/fpga_tio.py
[modify] https://crrev.com/93a23133d5612dd5a86dcd8a9efb866ddd36d7d4/chameleond/utils/ids.py

Project Member

Comment 14 by bugdroid1@chromium.org, May 5 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/chameleon/+/852e13ef696dff9cb862dcb272ebd0be56ab508c

commit 852e13ef696dff9cb862dcb272ebd0be56ab508c
Author: Cheng-Yi Chiang <cychiang@chromium.org>
Date: Fri May 05 10:11:01 2017

Tune motor range

Add helper function to test motor functions.

BUG= chromium:685530 
TEST=run TestMotors() and PressOneFunc() in test_server

Change-Id: I773ee41619bb3d4e96100aae81ade2c8030918f3
Reviewed-on: https://chromium-review.googlesource.com/479616
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@google.com>

[modify] https://crrev.com/852e13ef696dff9cb862dcb272ebd0be56ab508c/chameleond/devices/motor_board.py
[modify] https://crrev.com/852e13ef696dff9cb862dcb272ebd0be56ab508c/client/test_server.py

Project Member

Comment 15 by bugdroid1@chromium.org, Jun 5 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/autotest/+/aed6cdb32f75cecdb99cd1a223376b5b2677af81

commit aed6cdb32f75cecdb99cd1a223376b5b2677af81
Author: Cheng-Yi Chiang <cychiang@chromium.org>
Date: Mon Jun 05 05:09:45 2017

[autotest] Add API to control motor board on chameleon

In server side test, we can use motor_board = host.chameleon.get_motor_board()
to get motor board.
Then we can use motor_board.Touch(func) and motor_board.Release(func)
where func is defined in motor_board module.

BUG= chromium:685530 
TEST=test above usage in a server side test.

Change-Id: Ide3dc8bc925490f52748d463b3e652b27f50e949
Reviewed-on: https://chromium-review.googlesource.com/519044
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@google.com>

[add] https://crrev.com/aed6cdb32f75cecdb99cd1a223376b5b2677af81/client/cros/chameleon/motor_board.py
[modify] https://crrev.com/aed6cdb32f75cecdb99cd1a223376b5b2677af81/client/cros/chameleon/chameleon.py

The demo usage is in this CL https://chromium-review.googlesource.com/#/c/519045/

Autotest support and chameleon support are all merged.

The chameleon bundle is not updated to test lab yet.
We will schedule a proper time to deploy it when test lab becomes stable.

Comment 17 by dchan@google.com, Jun 5 2017

Cc: ka...@chromium.org
Thanks for the update cychiang@! I'll start working on a test to use these API's. Whats the ETA on Atrus / Jabra holders arriving in MTV?
Will get the holders in ready on June 21.  Trying to arrange for documents and shipping to be arranged in advance so we could ship it as soon as it is ready.
Some suggestions from Harpreet:

1. Add logic for the reset position. It should be about 2mm above the button, instead of all the way to the top.

2. Speed up the motor movement.
https://chromium-review.googlesource.com/573882 posted.

It increased the motor movement speed, and set a reset position that is 2cm above the button.

The distance is reserved for the variation of the foam.

I tuned the parameters for Atrus. I will test on Jabra and update the CL.
Project Member

Comment 22 by bugdroid1@chromium.org, Jul 18 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/chameleon/+/5da3d0dfad4288cd35492225977f293038977797

commit 5da3d0dfad4288cd35492225977f293038977797
Author: Cheng-Yi Chiang <cychiang@chromium.org>
Date: Tue Jul 18 04:27:14 2017

WIP motor_board: Set reset position

Increase the motor movement speed.

Set a reset position in motor parameters.
With this reset position, motor can be moved to a small distance above
button, so the movement of touch/release will be shorter.

TODO: Tune the parameters for Jabra speaker.

BUG= chromium:685530 
TEST=Use test_server, call p.motor_board.Reset() and see motor is
stayed at about 2 cm above button.
TEST=Test buttons by calls like PressOneFunc('Vol Up')

Change-Id: Ia7934d484d44875a37c1555223c76419e7715ca6
Reviewed-on: https://chromium-review.googlesource.com/573882
Commit-Ready: Harpreet Grewal <harpreet@chromium.org>
Tested-by: Harpreet Grewal <harpreet@chromium.org>
Reviewed-by: Harpreet Grewal <harpreet@chromium.org>

[modify] https://crrev.com/5da3d0dfad4288cd35492225977f293038977797/chameleond/devices/motor_board.py

https://chromium-review.googlesource.com/#/c/575256/ tunes the parameters for Jabra, and fix the speed of movement.
Project Member

Comment 24 by bugdroid1@chromium.org, Jul 18 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/chameleon/+/7ce703b6137bcd75e7fabf1ec824d1ca1a966e0f

commit 7ce703b6137bcd75e7fabf1ec824d1ca1a966e0f
Author: Cheng-Yi Chiang <cychiang@chromium.org>
Date: Tue Jul 18 23:46:30 2017

motor_board: Tune the parameters for Jabra and Atrus speaker

Use larger period_ms since motor can not handle 0.1 ms.
There will be jitter during movement when setting to 0.1 ms.

BUG= chromium:685530 
TEST=test motor on Jabra speaker

Change-Id: I6b9aebfdc69c1b201ebc33655d200d89e7b1b5c9
Reviewed-on: https://chromium-review.googlesource.com/575256
Commit-Ready: Harpreet Grewal <harpreet@chromium.org>
Tested-by: Harpreet Grewal <harpreet@chromium.org>
Reviewed-by: Harpreet Grewal <harpreet@chromium.org>

[modify] https://crrev.com/7ce703b6137bcd75e7fabf1ec824d1ca1a966e0f/chameleond/devices/motor_board.py

Status: Fixed (was: Started)
Changes were merged and bundle was pushed.

Comment 26 by dchan@chromium.org, Jan 22 2018

Status: Archived (was: Fixed)

Sign in to add a comment