Tilt sensor problem

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

Tilt sensor problem

Post by robonova » Thu Jul 29, 2010 3:46 pm

Post by robonova
Thu Jul 29, 2010 3:46 pm

I just got a tilt sensor for my RN-1. I used the example code that came with the instructions which also was the same code in the RN templates. The problem is that the sensor doesn't seem to be working correctly...or is too sensitive. It gets stuck in a loop to where the robot keeps doing the forward stand up move. If I lay the sensor on the the side it stops but if I barely move the sensor it starts again.

Below is the code that came with the template and also as the example. It seems to be working for others. I've tried it with several different ports, so it's not just one port thats the cause.

'robot_tilt:
robot_tilt:
A = AD(2)
IF A > 250 THEN RETURN
IF A <30> 200 THEN GOTO tilt_high

RETURN
tilt_low:
A = AD(2)
'IF A < 30 THEN GOTO forward_standup
IF A < 30 THEN GOTO backward_standup
RETURN
tilt_high:
A = AD(2)
'IF A > 200 THEN GOTO backward_standup
IF A > 200 THEN GOTO forward_standup




For me, I had to change the code that says

IF A > 200 THEN GOTO tilt_high

to

IF A > 18 THEN GOTO tilt_high

That change seemed to work as odd as it looks.....however....

when I try to change this code

IF A < 30 THEN GOTO tilt_low

to anything above 6 it keeps getting stuck in the loop and executing the move. If I change it to 6 .. in other words to:

IF A < 6 THEN GOTO tilt_low

Then it won't every execute the move no matter how I turn the robot.

Does anyone have any suggestion as to what I'm doing wrong or is it the sensor that is not working?

Thanks
I just got a tilt sensor for my RN-1. I used the example code that came with the instructions which also was the same code in the RN templates. The problem is that the sensor doesn't seem to be working correctly...or is too sensitive. It gets stuck in a loop to where the robot keeps doing the forward stand up move. If I lay the sensor on the the side it stops but if I barely move the sensor it starts again.

Below is the code that came with the template and also as the example. It seems to be working for others. I've tried it with several different ports, so it's not just one port thats the cause.

'robot_tilt:
robot_tilt:
A = AD(2)
IF A > 250 THEN RETURN
IF A <30> 200 THEN GOTO tilt_high

RETURN
tilt_low:
A = AD(2)
'IF A < 30 THEN GOTO forward_standup
IF A < 30 THEN GOTO backward_standup
RETURN
tilt_high:
A = AD(2)
'IF A > 200 THEN GOTO backward_standup
IF A > 200 THEN GOTO forward_standup




For me, I had to change the code that says

IF A > 200 THEN GOTO tilt_high

to

IF A > 18 THEN GOTO tilt_high

That change seemed to work as odd as it looks.....however....

when I try to change this code

IF A < 30 THEN GOTO tilt_low

to anything above 6 it keeps getting stuck in the loop and executing the move. If I change it to 6 .. in other words to:

IF A < 6 THEN GOTO tilt_low

Then it won't every execute the move no matter how I turn the robot.

Does anyone have any suggestion as to what I'm doing wrong or is it the sensor that is not working?

Thanks
robonova offline
Newbie
Newbie
Posts: 1
Joined: Thu Jul 29, 2010 3:20 pm

1 postPage 1 of 1
1 postPage 1 of 1