Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

Turning Motors Off

Hitec robotics including ROBONOVA humanoid, HSR-8498HB servos, MR C-3024 Controllers and RoboBasic
12 postsPage 1 of 1
12 postsPage 1 of 1

Turning Motors Off

Post by JavaRN » Mon Aug 20, 2007 3:25 pm

Post by JavaRN
Mon Aug 20, 2007 3:25 pm

I am using ports 15 and 16 to communicate with my SP03 using the I2C bus. Everything works well until I add code that switch motors on. The SP03 continuously keeps resetting itself. I tried to switch from the code motors 15 and 16 off using the following code:

Code: Select all
' zero position
ZERO G6A, 99, 102,  97, 101, 102
ZERO G6B,100, 103,  99, 117
ZERO G6C, 99, 100,  98, , , 92
ZERO G6D,100, 104, 103, 101, 104, 115

GOTO AUTO
FILL 255,10000

PTP SETON             
PTP ALLON

'== motor diretion setting ======================
DIR G6A,1,0,0,1,0,0      
DIR G6B,1,1,1,0,1,1      
DIR G6C,0,0,0,0,0,0      
DIR G6D,0,1,1,0,1,0   

GETMOTORSET G24,1,1,1,1,1,0,1,1,1,0,0,0,1,1,1,1,1,0,1,1,1,1,1,0


DELAY 5000

SPEED 5

 DIM mtr AS BYTE
 
 'switch motors 0 to 14 on
 FOR mtr = 0 TO 14
    MOTOR mtr
 NEXT mtr
 
 'switch motors 17 to 23 on
 FOR mtr = 17 TO 23
   MOTOR mtr
 NEXT mtr

' switch 15 and 16 off
 MOTOROFF 15
 MOTOROFF 16



But the SP03 still reboots itself. What am I doing wrong?

Note: I assume that ports 15 and 16 correspond to motors 15 and 16. Am I right. Any help is more than welcome.

Charles
I am using ports 15 and 16 to communicate with my SP03 using the I2C bus. Everything works well until I add code that switch motors on. The SP03 continuously keeps resetting itself. I tried to switch from the code motors 15 and 16 off using the following code:

Code: Select all
' zero position
ZERO G6A, 99, 102,  97, 101, 102
ZERO G6B,100, 103,  99, 117
ZERO G6C, 99, 100,  98, , , 92
ZERO G6D,100, 104, 103, 101, 104, 115

GOTO AUTO
FILL 255,10000

PTP SETON             
PTP ALLON

'== motor diretion setting ======================
DIR G6A,1,0,0,1,0,0      
DIR G6B,1,1,1,0,1,1      
DIR G6C,0,0,0,0,0,0      
DIR G6D,0,1,1,0,1,0   

GETMOTORSET G24,1,1,1,1,1,0,1,1,1,0,0,0,1,1,1,1,1,0,1,1,1,1,1,0


DELAY 5000

SPEED 5

 DIM mtr AS BYTE
 
 'switch motors 0 to 14 on
 FOR mtr = 0 TO 14
    MOTOR mtr
 NEXT mtr
 
 'switch motors 17 to 23 on
 FOR mtr = 17 TO 23
   MOTOR mtr
 NEXT mtr

' switch 15 and 16 off
 MOTOROFF 15
 MOTOROFF 16



But the SP03 still reboots itself. What am I doing wrong?

Note: I assume that ports 15 and 16 correspond to motors 15 and 16. Am I right. Any help is more than welcome.

Charles
F'dan il-passatemp ghandek bzonn zewg affarijiet - FLUS u HIN. Zewg affarijiet li huma skarsi hafna u li jien minnhom ghandi vera ftit!
JavaRN
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 282
Joined: Fri Mar 02, 2007 11:01 pm

Post by NovaOne » Mon Aug 20, 2007 6:31 pm

Post by NovaOne
Mon Aug 20, 2007 6:31 pm

Yes I had the same problem when I first integrated by compass code in to RN template. This is how i solved it:
.........
I tried to issue a MOTOROFF 15 and MOTOROFF 16 commands to free up the ports to use for I2c,However the MOTOROFF [servo number] command did not seem work after a MOTOR G24, so I turned on the required servos with the MOTOR [servo number] command, in place of MOTOR G24:
....
SPEED 5
MOTOR 0
MOTOR 1
MOTOR 2
MOTOR 3
MOTOR 4
MOTOR 6
MOTOR 7
MOTOR 8
'MOTOR 9 'Left hand
'MOTOR 11 'Head
MOTOR 12
MOTOR 13
MOTOR 14
'MOTOR 17 'Right hand
MOTOR 18
MOTOR 19
MOTOR 20
MOTOR 21
MOTOR 22
.....


This quote is from:http://robosavvy.com/forum/viewtopic.php?t=1567


Chris
Yes I had the same problem when I first integrated by compass code in to RN template. This is how i solved it:
.........
I tried to issue a MOTOROFF 15 and MOTOROFF 16 commands to free up the ports to use for I2c,However the MOTOROFF [servo number] command did not seem work after a MOTOR G24, so I turned on the required servos with the MOTOR [servo number] command, in place of MOTOR G24:
....
SPEED 5
MOTOR 0
MOTOR 1
MOTOR 2
MOTOR 3
MOTOR 4
MOTOR 6
MOTOR 7
MOTOR 8
'MOTOR 9 'Left hand
'MOTOR 11 'Head
MOTOR 12
MOTOR 13
MOTOR 14
'MOTOR 17 'Right hand
MOTOR 18
MOTOR 19
MOTOR 20
MOTOR 21
MOTOR 22
.....


This quote is from:http://robosavvy.com/forum/viewtopic.php?t=1567


Chris
NovaOne
Savvy Roboteer
Savvy Roboteer
Posts: 405
Joined: Thu Jul 05, 2007 7:30 am

Post by JavaRN » Mon Aug 20, 2007 7:43 pm

Post by JavaRN
Mon Aug 20, 2007 7:43 pm

Therefore there is a bug in Roboasic because the two loops I use should have the same effect as writing a list of motor commands! Thanks again Chris


Charles
Therefore there is a bug in Roboasic because the two loops I use should have the same effect as writing a list of motor commands! Thanks again Chris


Charles
F'dan il-passatemp ghandek bzonn zewg affarijiet - FLUS u HIN. Zewg affarijiet li huma skarsi hafna u li jien minnhom ghandi vera ftit!
JavaRN
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 282
Joined: Fri Mar 02, 2007 11:01 pm

Post by NovaOne » Mon Aug 20, 2007 7:48 pm

Post by NovaOne
Mon Aug 20, 2007 7:48 pm

Yes, I think there is a bug in RoboBASIC.
Unless any one else can enlighten us?
Yes, I think there is a bug in RoboBASIC.
Unless any one else can enlighten us?
NovaOne
Savvy Roboteer
Savvy Roboteer
Posts: 405
Joined: Thu Jul 05, 2007 7:30 am

Post by i-Bot » Mon Aug 20, 2007 7:53 pm

Post by i-Bot
Mon Aug 20, 2007 7:53 pm

There is something strange here.

JavaRN, could you try the same code, but without the MOTOROFF instructions ?

The compiler seems to turn MOTOROFF to MOTOR !

Motors are off by default
There is something strange here.

JavaRN, could you try the same code, but without the MOTOROFF instructions ?

The compiler seems to turn MOTOROFF to MOTOR !

Motors are off by default
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by JavaRN » Mon Aug 20, 2007 8:25 pm

Post by JavaRN
Mon Aug 20, 2007 8:25 pm

I tried this but it didn't work either!!!!! (The SP03 continues to reset all the time, BUT if I remove all the MOTOR commands everything is ok) Could it be something from the ZERO or some other command. Thanks

' zero position
ZERO G6A, 99, 102, 97, 101, 102
ZERO G6B,100, 103, 99, 117
ZERO G6C, 99, 100, 98, , , 92
ZERO G6D,100, 104, 103, 101, 104, 115

GOTO AUTO
FILL 255,10000

PTP SETON
PTP ALLON

'== motor diretion setting ======================
DIR G6A,1,0,0,1,0,0
DIR G6B,1,1,1,0,1,1
DIR G6C,0,0,0,0,0,0
DIR G6D,0,1,1,0,1,0

GETMOTORSET G24,1,1,1,1,1,0,1,1,1,0,0,0,1,1,1,1,1,0,1,1,1,1,1,0

DELAY 5000

SPEED 5

DIM mtr AS BYTE

MOTOR 0
MOTOR 1
MOTOR 2
MOTOR 3
MOTOR 4
MOTOR 5
MOTOR 6
MOTOR 7
MOTOR 8
MOTOR 9
MOTOR 10
MOTOR 11
MOTOR 12
MOTOR 13
MOTOR 14
MOTOR 17
MOTOR 18
MOTOR 19
MOTOR 20
MOTOR 21
MOTOR 22
MOTOR 23

GOSUB STANDARD_POSE
I tried this but it didn't work either!!!!! (The SP03 continues to reset all the time, BUT if I remove all the MOTOR commands everything is ok) Could it be something from the ZERO or some other command. Thanks

' zero position
ZERO G6A, 99, 102, 97, 101, 102
ZERO G6B,100, 103, 99, 117
ZERO G6C, 99, 100, 98, , , 92
ZERO G6D,100, 104, 103, 101, 104, 115

GOTO AUTO
FILL 255,10000

PTP SETON
PTP ALLON

'== motor diretion setting ======================
DIR G6A,1,0,0,1,0,0
DIR G6B,1,1,1,0,1,1
DIR G6C,0,0,0,0,0,0
DIR G6D,0,1,1,0,1,0

GETMOTORSET G24,1,1,1,1,1,0,1,1,1,0,0,0,1,1,1,1,1,0,1,1,1,1,1,0

DELAY 5000

SPEED 5

DIM mtr AS BYTE

MOTOR 0
MOTOR 1
MOTOR 2
MOTOR 3
MOTOR 4
MOTOR 5
MOTOR 6
MOTOR 7
MOTOR 8
MOTOR 9
MOTOR 10
MOTOR 11
MOTOR 12
MOTOR 13
MOTOR 14
MOTOR 17
MOTOR 18
MOTOR 19
MOTOR 20
MOTOR 21
MOTOR 22
MOTOR 23

GOSUB STANDARD_POSE
F'dan il-passatemp ghandek bzonn zewg affarijiet - FLUS u HIN. Zewg affarijiet li huma skarsi hafna u li jien minnhom ghandi vera ftit!
JavaRN
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 282
Joined: Fri Mar 02, 2007 11:01 pm

Post by NovaOne » Mon Aug 20, 2007 8:43 pm

Post by NovaOne
Mon Aug 20, 2007 8:43 pm

It also confuses me...

I think some other commands my still be able to change the state of those ports...?

Before I realized my Motoroff commands did not work, I did remove ALL reference to these ports in some standard RN template moves.

I did this by deleting the offending servo position number in the MOVE commands, just leaving a space with commas each side, (just in case it was these some how interfering?)

eg MOVE G6C,100, 30, 80, , , ,

The only reason I can think that there were servo position numbers in these move commands was lazy programming on the part of Hitec.

Good luck

Chris
It also confuses me...

I think some other commands my still be able to change the state of those ports...?

Before I realized my Motoroff commands did not work, I did remove ALL reference to these ports in some standard RN template moves.

I did this by deleting the offending servo position number in the MOVE commands, just leaving a space with commas each side, (just in case it was these some how interfering?)

eg MOVE G6C,100, 30, 80, , , ,

The only reason I can think that there were servo position numbers in these move commands was lazy programming on the part of Hitec.

Good luck

Chris
NovaOne
Savvy Roboteer
Savvy Roboteer
Posts: 405
Joined: Thu Jul 05, 2007 7:30 am

Post by NovaOne » Mon Aug 20, 2007 9:12 pm

Post by NovaOne
Mon Aug 20, 2007 9:12 pm

Sorry I've just check my template again.... I did not remove all (only some) of the MOVE G6C references to servo ports 15 and 16...and ones that remain don't appear interfere.

Chris
Sorry I've just check my template again.... I did not remove all (only some) of the MOVE G6C references to servo ports 15 and 16...and ones that remain don't appear interfere.

Chris
NovaOne
Savvy Roboteer
Savvy Roboteer
Posts: 405
Joined: Thu Jul 05, 2007 7:30 am

Post by NovaOne » Mon Aug 20, 2007 9:20 pm

Post by NovaOne
Mon Aug 20, 2007 9:20 pm

The only big difference I can see between my code and yours is that I don't include the Zero commands, since I used the Zero Set routine to write to the EEPROM, I do not see the point in rewriting it every time I run a program.

Chris
The only big difference I can see between my code and yours is that I don't include the Zero commands, since I used the Zero Set routine to write to the EEPROM, I do not see the point in rewriting it every time I run a program.

Chris
NovaOne
Savvy Roboteer
Savvy Roboteer
Posts: 405
Joined: Thu Jul 05, 2007 7:30 am

Post by NovaOne » Mon Aug 20, 2007 9:28 pm

Post by NovaOne
Mon Aug 20, 2007 9:28 pm

Sorry its me again, try putting zeros in the locations that coincide with outputs 15 and 16 in the GETMOTORSET G24 command.

Chris
Sorry its me again, try putting zeros in the locations that coincide with outputs 15 and 16 in the GETMOTORSET G24 command.

Chris
NovaOne
Savvy Roboteer
Savvy Roboteer
Posts: 405
Joined: Thu Jul 05, 2007 7:30 am

Post by i-Bot » Mon Aug 20, 2007 10:21 pm

Post by i-Bot
Mon Aug 20, 2007 10:21 pm

Setitng the bit for GETMOTORSET wil force a servo read position. This will leave the port in the output state.

I agree, either, do not read the servo position, or send an IN to the port after to make the direction back in again.

Putting code before the GOTO Auto is sort of bad too. GOTO Auto jumps to the fixed location 0x2728. The FILL fills with NOPS, so your GOTO always lands in the NOPS before AUTO.
Setitng the bit for GETMOTORSET wil force a servo read position. This will leave the port in the output state.

I agree, either, do not read the servo position, or send an IN to the port after to make the direction back in again.

Putting code before the GOTO Auto is sort of bad too. GOTO Auto jumps to the fixed location 0x2728. The FILL fills with NOPS, so your GOTO always lands in the NOPS before AUTO.
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by JavaRN » Mon Aug 20, 2007 10:22 pm

Post by JavaRN
Mon Aug 20, 2007 10:22 pm

I tried everything but nothing seems to work and to make matters worse I ended up out of battery power so I will resume work tomorrow morning. I will let you know my progress by tomorrow. Thanks for your help.
I tried everything but nothing seems to work and to make matters worse I ended up out of battery power so I will resume work tomorrow morning. I will let you know my progress by tomorrow. Thanks for your help.
F'dan il-passatemp ghandek bzonn zewg affarijiet - FLUS u HIN. Zewg affarijiet li huma skarsi hafna u li jien minnhom ghandi vera ftit!
JavaRN
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 282
Joined: Fri Mar 02, 2007 11:01 pm


12 postsPage 1 of 1
12 postsPage 1 of 1