Skip to content

Commit 5cd0b62

Browse files
committed
Fixed simulation not driving like real rovers
sBrdige would not map speeds correctly and the max speed was to low for rotation This has been corrected to allow 4.5 radians per second and 0.6 m/s for respective movments and roughly mapping -255 - +255 onto -4.5 - +4.5 for rotation and the equivalent for linear Also the maximum alignment error was increased by 0.05 radians to prevent possible oscilliaions. Known additonal bug, robot may seem to freeze on rare occasion biased towards the start of sim but it will eventually turn to correct heading and drive.
1 parent 079d5de commit 5cd0b62

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/behaviours/src/DriveController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class DriveController : virtual Controller
2929

3030
bool interupt = false;
3131

32-
float rotateOnlyAngleTolerance = 0.1;
32+
float rotateOnlyAngleTolerance = 0.15;
3333
float finalRotationTolerance = 0.2;
3434
const float waypointTolerance = 0.15; //15 cm tolerance.
3535

src/sbridge/src/sbridge.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void sbridge::cmdHandler(const geometry_msgs::Twist::ConstPtr& message) {
2424
double left = (message->linear.x);
2525
double right = (message->angular.z);
2626

27-
float max_turn_rate = 3.14; //radians per second
27+
float max_turn_rate = 4.5; //radians per second
2828
float max_linear_velocity = 0.6; // meters per second
2929

3030
float turn = 0;
@@ -47,8 +47,8 @@ void sbridge::cmdHandler(const geometry_msgs::Twist::ConstPtr& message) {
4747
float linearVel = (left + right)/2;
4848
float angularVel = (right-left)/2;
4949

50-
turn = angularVel/180;
51-
forward = linearVel/400;
50+
turn = angularVel/55;
51+
forward = linearVel/425;
5252
if (forward >= 150){
5353

5454
forward -= (abs(turn)/5);

0 commit comments

Comments
 (0)