|
Page 1 of 1
|
[ 6 posts ] |
|
Curriculum Companion -- both Sonar and Compass aren't workin
Author |
Message |
kathweaver
Rookie
Joined: Wed Nov 16, 2011 1:24 pm Posts: 4
|
 Curriculum Companion -- both Sonar and Compass aren't workin
Using Curriuculum Companionm trying to do the Obstacle Course and I don't seem to be getting correct values for either the Compass or Sonar Sensor. Sonar is always -1. I have everything on the correct ports.  |  |  |  | Code: #pragma config(Sensor, S1, touchSensor, sensorTouch) #pragma config(Sensor, S2, compassSensor, sensorVirtualCompass) #pragma config(Sensor, S3, lightSensor, sensorLightActive) #pragma config(Sensor, S4, sonarSensor, sensorSONAR) #pragma config(Motor, motorA, gripperMotor, tmotorNormal, PIDControl, encoder) #pragma config(Motor, motorB, rightMotor, tmotorNormal, PIDControl, encoder) #pragma config(Motor, motorC, leftMotor, tmotorNormal, PIDControl, encoder) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main() { nMotorEncoder[motorC]=0;
while(SensorValue[touchSensor]==0) { motor[rightMotor] = 75; // Motor on motorB is run at full (100) power forward motor[leftMotor] = 75; // Motor on motorC is run at full (100) power forward }
motor[rightMotor] =0; motor[leftMotor]=0;
} // Program ends, and the robot stops //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|  |  |  |  |
I also checked to make sure I had the right platform.
|
Mon Sep 23, 2013 1:40 pm |
|
 |
rcahoon
Site Admin
Joined: Tue Oct 09, 2012 10:34 am Posts: 192
|
 Re: Curriculum Companion -- both Sonar and Compass aren't wo
Hi Kath, Make sure your ROBOTC is updated. In recent versions of the Curriculum Companion, the robots are equipped with gyro sensors rather than compasses. Gyros give values in 1/10s of a degree. A sonar value of -1 means the robot isn't seeing any obstacles (see here for more info on this). To help you diagnose what the sonar sensor is (or isn't) observing, try clicking the the button in the bottom-right corner of the in-game interface (looks like a camera with waves coming out of it). Best, --Ryan
_________________ Ryan Cahoon CMU Robotics Academy RVW Software Developer
Robot Potato Head; Virtual NXT
|
Mon Sep 23, 2013 1:50 pm |
|
 |
kathweaver
Rookie
Joined: Wed Nov 16, 2011 1:24 pm Posts: 4
|
 Re: Curriculum Companion -- both Sonar and Compass aren't wo
 |  |  |  | rcahoon wrote: Hi Kath, Make sure your ROBOTC is updated. In recent versions of the Curriculum Companion, the robots are equipped with gyro sensors rather than compasses. Gyros give values in 1/10s of a degree. A sonar value of -1 means the robot isn't seeing any obstacles (see here for more info on this). To help you diagnose what the sonar sensor is (or isn't) observing, try clicking the the button in the bottom-right corner of the in-game interface (looks like a camera with waves coming out of it). Best, --Ryan |  |  |  |  |
Running the latest updates. We do see the camera with waves coming out of it, and it appears the waves may be shooting up over the obstacles in the table, is there a way to move the sensors down? The gyro values still seem odd.
|
Mon Sep 23, 2013 2:10 pm |
|
 |
rcahoon
Site Admin
Joined: Tue Oct 09, 2012 10:34 am Posts: 192
|
 Re: Curriculum Companion -- both Sonar and Compass aren't wo
No way to move the sensors, no. You can select a different model of robot from the Robots tab in the main menu, though.
What's odd about the gyro values?
_________________ Ryan Cahoon CMU Robotics Academy RVW Software Developer
Robot Potato Head; Virtual NXT
|
Mon Sep 23, 2013 4:38 pm |
|
 |
kathweaver
Rookie
Joined: Wed Nov 16, 2011 1:24 pm Posts: 4
|
 Re: Curriculum Companion -- both Sonar and Compass aren't wo
When the robot spins, the gyro values continue to go up, rather than going back down to zero.
|
Mon Sep 23, 2013 4:55 pm |
|
 |
rcahoon
Site Admin
Joined: Tue Oct 09, 2012 10:34 am Posts: 192
|
 Re: Curriculum Companion -- both Sonar and Compass aren't wo
Gyro sensors actually measure the rate of rotation, rather than the absolute angle like a compass. We obtain the reported gyro measurement by integrating the rate value. This means that as long as the robot keeps rotating in the same direction, the angle value will keep increasing or decreasing in the same direction. If you want to normalize the angle value, you can calculate the value modulus 3600: This code looks rather complex because it has to deal with negative numbers as well. This will return a number between 0 and 3599 representing 0 to 359.9 degrees.
_________________ Ryan Cahoon CMU Robotics Academy RVW Software Developer
Robot Potato Head; Virtual NXT
|
Mon Sep 23, 2013 5:13 pm |
|
|
|
Page 1 of 1
|
[ 6 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 2 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|