Closed chrisspen closed 7 years ago
I've used the code with the micro and the mini 12 with equal success. I'd expect the 24 to work as well.
From your pc, use the polulu Maestro Control Center to set the device to USB dual serial mode.
On your Pi, be sure to install the pyserial library and always run your code using sudo.
As for analog inputs, the maestro is capable, but my code hasn't any support for that. I have done analog reads before and it should be easy enough to extend my class to accommodate.
Let me know if how you make out.
Steve
Sent from my iPod
On Jun 1, 2015, at 10:45 PM, Chris Spencer notifications@github.com wrote:
Should this code work with the Maestro 24? Pololu's docs all state each channel needs to be enabled before using and that once enabled the yellow LED should flash twice, but I don't see anything in your code that enables the channel before use.
Also, I believe most pins on the Maestros also double as a true analog input, but there doesn't appear to be an interface for this in your class. Is this possible?
— Reply to this email directly or view it on GitHub.
I just noticed that you are running this on a Linux pc, not a raspberry Pi. No problem, it should work fine from your Linux box, as long as you have the prerequisites done.
Sent from my iPod
On Jun 1, 2015, at 10:45 PM, Chris Spencer notifications@github.com wrote:
Should this code work with the Maestro 24? Pololu's docs all state each channel needs to be enabled before using and that once enabled the yellow LED should flash twice, but I don't see anything in your code that enables the channel before use.
Also, I believe most pins on the Maestros also double as a true analog input, but there doesn't appear to be an interface for this in your class. Is this possible?
— Reply to this email directly or view it on GitHub.
Thanks. I actually plan to be using this from both an x86 machine and RPi or Odroid, both running Ubuntu. I'll try your suggestions later tonight.
Although I had a little trouble even getting the Maestro to work with the control center. I'm not sure what I did, but I was finally able to get a servo on channel 0 to move by setting it to "UART, fixed baud rate" with rate 57600. I'll try and explicitly test "USB Dual Port".
I wouldn't mind extending your code to support analog reads. Assuming the mode is set to read, it looks like your getPosition() method would do this. However, I'm going through the manual, and I don't see any documented commands for setting mode under the "5.e. Serial Servo Commands" section. Do you know where this is documented?
I also noticed you seem to be using the "Pololu protocol" and are using the hard-coded device number "12". Would this be different for the Maestro 24?
I believe you'll have to use the control center to set channels to analog. And yes, the getPosition method will read the voltage.
Device number can be set in the control center as well. It defaults to 12 (0xC).
Sent from my iPod
On Jun 2, 2015, at 9:47 AM, Chris Spencer notifications@github.com wrote:
Thanks. I actually plan to be using this from both an x86 machine and RPi or Odroid, both running Ubuntu. I'll try your suggestions later tonight.
Although I had a little trouble even getting the Maestro to work with the control center. I'm not sure what I did, but I was finally able to get a servo on channel 0 to move by setting it to "UART, fixed baud rate" with rate 57600. I'll try and explicitly test "USB Dual Port".
I wouldn't mind extending your code to support analog reads. Assuming the mode is set to read, it looks like your getPosition() method would do this. However, I'm going through the manual, and I don't see any documented commands for setting mode under the "5.e. Serial Servo Commands" section. Do you know where this is documented?
I also noticed you seem to be using the "Pololu protocol" and are using the hard-coded device number "12". Would this be different for the Maestro 24?
— Reply to this email directly or view it on GitHub.
Are you sure? Everytime I unplug my Maestro, it seems to lose all settings configured through the control center.
Yes, as long as you click the Apply Settings button on the Control Center after making your changes, they should be saved.
Here's the Serial settings you should have. Note that I'm set for Device Number 12.
[image: Inline image 1]
Use the Channel Settings tab to configure channels for analog by changing the Mode from Servo to Input. Again, Apply Settings once you make a change.
Other settings on the Channel Settings tab are useful as well, and are saved as start-up values. Min and Max control that endpoints of the servo travel. Speed and Acceleration control how quickly the servo will move to a target. Both Speed and Acceleration can be control from the Python class. Min and Max, however are not something that can be set anywhere bu on the Control Center.
Hope this helps.
Steve
On Wed, Jun 3, 2015 at 1:42 PM, Chris Spencer notifications@github.com wrote:
Are you sure? Everytime I unplug my Maestro, it seems to lose all settings configured through the control center.
— Reply to this email directly or view it on GitHub https://github.com/FRC4564/Maestro/issues/1#issuecomment-108542268.
Should this code work with the Maestro 24? Pololu's docs all state each channel needs to be enabled before using and that once enabled the yellow LED should flash twice, but I don't see anything in your code that enables the channel before use.
Also, I believe most pins on the Maestros also double as a true analog input, but there doesn't appear to be an interface for this in your class. Is this possible?