HELP! Programming troubles

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

HELP! Programming troubles

Post by rino2 » Mon Aug 17, 2009 8:53 am

Post by rino2
Mon Aug 17, 2009 8:53 am

Hi to all!!!

I'm new here so I beg your pardon if the question is alrerady solved!!

I'm traing to move shoulder, elbow and grip tool, step by step using the SERVO istruction because for each movement I want to check for a key pressed to stop the movements.
The problem is quite simple... When the servo must move from 10 or 100 to max (190) there is non problem..
EG.
L_Harm_up: ' Shoulder rotation UP
arm_ud =MOTORIN(6)
wmi_max =190
FOR wmi =arm_ud TO wmi_max
GOSUB in_key
SERVO 6,wmi
DELAY 50
NEXT wmi
GOTO GetCmnd
But when it must move from max to min (eg 190 to 10 or 100)... here his the problem!!!!
FOR ...NEXT need the final value to be greater than the start (wmi_max greater than wmi), RoboBasic cant use negative number.....

So... there is a solution?? Can some one suggest me a way to work out?

To be clear... think to the shoulder... if I move it UP the renge value is correcti wmi is less than the maximum (190)... but is the shoulder must go down the final position of the motor is LESS than the start.....

Please I need your help!!!
Ciao
from Italy

Rino
Hi to all!!!

I'm new here so I beg your pardon if the question is alrerady solved!!

I'm traing to move shoulder, elbow and grip tool, step by step using the SERVO istruction because for each movement I want to check for a key pressed to stop the movements.
The problem is quite simple... When the servo must move from 10 or 100 to max (190) there is non problem..
EG.
L_Harm_up: ' Shoulder rotation UP
arm_ud =MOTORIN(6)
wmi_max =190
FOR wmi =arm_ud TO wmi_max
GOSUB in_key
SERVO 6,wmi
DELAY 50
NEXT wmi
GOTO GetCmnd
But when it must move from max to min (eg 190 to 10 or 100)... here his the problem!!!!
FOR ...NEXT need the final value to be greater than the start (wmi_max greater than wmi), RoboBasic cant use negative number.....

So... there is a solution?? Can some one suggest me a way to work out?

To be clear... think to the shoulder... if I move it UP the renge value is correcti wmi is less than the maximum (190)... but is the shoulder must go down the final position of the motor is LESS than the start.....

Please I need your help!!!
Ciao
from Italy

Rino
rino2 offline
Newbie
Newbie
Posts: 6
Joined: Mon Aug 17, 2009 8:42 am

Post by i-Bot » Mon Aug 17, 2009 10:30 am

Post by i-Bot
Mon Aug 17, 2009 10:30 am

Either use another variable and decrement it, or decrement arm_ud as below. Use this value for the servo command.

L_Harm_down: ' Shoulder rotation DOWN
arm_ud =MOTORIN(6)
wmi_min =10
FOR wmi =wmi_min TO arm_ud
GOSUB in_key
SERVO 6, arm_ud
arm_ud = arm_ud -1
DELAY 50
NEXT wmi
GOTO GetCmnd
Either use another variable and decrement it, or decrement arm_ud as below. Use this value for the servo command.

L_Harm_down: ' Shoulder rotation DOWN
arm_ud =MOTORIN(6)
wmi_min =10
FOR wmi =wmi_min TO arm_ud
GOSUB in_key
SERVO 6, arm_ud
arm_ud = arm_ud -1
DELAY 50
NEXT wmi
GOTO GetCmnd
i-Bot offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by rino2 » Mon Aug 17, 2009 10:41 am

Post by rino2
Mon Aug 17, 2009 10:41 am

Thanks for the answer....

I'll try it...
In the first step I was thinking to use the DIR command but it seems not working with SERVO command.... also... the SPEED command doesnt work with it....

Anyway... I'll try and I'll keep you informed...

thanks
Rino
Thanks for the answer....

I'll try it...
In the first step I was thinking to use the DIR command but it seems not working with SERVO command.... also... the SPEED command doesnt work with it....

Anyway... I'll try and I'll keep you informed...

thanks
Rino
rino2 offline
Newbie
Newbie
Posts: 6
Joined: Mon Aug 17, 2009 8:42 am

Post by rino2 » Tue Aug 18, 2009 1:47 pm

Post by rino2
Tue Aug 18, 2009 1:47 pm

I-Bot... thanks.. it works!!!!!!

big.. big.. thanks...

I've another question.. hope my english can help me... well
if you are a programmer you know that the command
cmnd =REMOCON(1)
makes a sort of stop of all the operation for less than a second.
If I want to make a continuos forward walking and I put the command cmnd =REMOCON(1) to stop the sequence (like an emergency key) by a remote key (not one in particular, the first key pressed) in one point of the MOVE24 the movement stop while the program is on remocon comand.
So.. have you tried to use a normal and AD(7) (7 is the port of IR receiver)
and check what you have?
Instead of REMOCON command I probably use AD(7)... or not?

Thanks
Rino
I-Bot... thanks.. it works!!!!!!

big.. big.. thanks...

I've another question.. hope my english can help me... well
if you are a programmer you know that the command
cmnd =REMOCON(1)
makes a sort of stop of all the operation for less than a second.
If I want to make a continuos forward walking and I put the command cmnd =REMOCON(1) to stop the sequence (like an emergency key) by a remote key (not one in particular, the first key pressed) in one point of the MOVE24 the movement stop while the program is on remocon comand.
So.. have you tried to use a normal and AD(7) (7 is the port of IR receiver)
and check what you have?
Instead of REMOCON command I probably use AD(7)... or not?

Thanks
Rino
rino2 offline
Newbie
Newbie
Posts: 6
Joined: Mon Aug 17, 2009 8:42 am

Post by i-Bot » Tue Aug 18, 2009 7:35 pm

Post by i-Bot
Tue Aug 18, 2009 7:35 pm

The REMOCON uses the AD(7) port in a different way. It looks for a serial protocol from the 38KHz receiver. So I don't think AD(7) will work.

The REMOCON is slow because it needs to provide a long enough time window to detect and decode a whole serial message. It disables the motion to allow accurate timing of the bit bang receiver.

You might try doing an IN(39). A low on this pin should indicate a 38Khz carrier bit is at least received.

Better remote control is by bluetooth or PS2 controller. Less impact on motion and faster.
The REMOCON uses the AD(7) port in a different way. It looks for a serial protocol from the 38KHz receiver. So I don't think AD(7) will work.

The REMOCON is slow because it needs to provide a long enough time window to detect and decode a whole serial message. It disables the motion to allow accurate timing of the bit bang receiver.

You might try doing an IN(39). A low on this pin should indicate a 38Khz carrier bit is at least received.

Better remote control is by bluetooth or PS2 controller. Less impact on motion and faster.
i-Bot offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by rino2 » Thu Aug 20, 2009 9:44 am

Post by rino2
Thu Aug 20, 2009 9:44 am

Hi, i-Bot

Your suggestion is very usefull... as usual!!!!
BUT..... I had very random answer from using IN(39)....
I mean... not every time a key pressure is recognized... I can't check if this problem is because the function is "too speed" and I can't press a key in time or because the answer of the port is not standard....

I can check it only when I'll finisch the display and using a little program for the visualization of the port answer (and also for the tilt, accellerometer and IR distance value)..........

Thanks.....
Hi, i-Bot

Your suggestion is very usefull... as usual!!!!
BUT..... I had very random answer from using IN(39)....
I mean... not every time a key pressure is recognized... I can't check if this problem is because the function is "too speed" and I can't press a key in time or because the answer of the port is not standard....

I can check it only when I'll finisch the display and using a little program for the visualization of the port answer (and also for the tilt, accellerometer and IR distance value)..........

Thanks.....
rino2 offline
Newbie
Newbie
Posts: 6
Joined: Mon Aug 17, 2009 8:42 am


6 postsPage 1 of 1
6 postsPage 1 of 1