Skip to content

Commit

Permalink
set linear speed to max to simplify prediction of speed
Browse files Browse the repository at this point in the history
  • Loading branch information
tevenfeng committed Oct 24, 2018
1 parent 76ee471 commit bd50589
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tju_car/src/tju_car.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,14 @@ void TjuCar::joy_callback(const sensor_msgs::Joy::ConstPtr& Joy)
pthread_mutex_lock(&mutex);
geometry_msgs::Twist v;
if(!isShutdown){
v.linear.x =Joy->axes[axisLinear]*MAX_LINEAR_VEL;
if(Joy->axes[axisLinear]>0){
v.linear.x = MAX_LINEAR_VEL;
}else if(Joy->axes[axisLinear]<0){
v.linear.x = -MAX_LINEAR_VEL;
}else{
v.linear.x = 0;
}
//v.linear.x =Joy->axes[axisLinear]*MAX_LINEAR_VEL;
v.angular.z =Joy->axes[axisAngular]*MAX_ANGULAR_VEL;
}else{
v.linear.x = 0;
Expand All @@ -118,7 +125,14 @@ void TjuCar::navigation_callback(const sensor_msgs::Joy::ConstPtr& navigationJoy

geometry_msgs::Twist v;
if(!isShutdown){
v.linear.x = navigationJoy->axes[axisLinear]*MAX_LINEAR_VEL;
if(navigationJoy->axes[axisLinear]>0){
v.linear.x = MAX_LINEAR_VEL;
}else if(navigationJoy->axes[axisLinear]<0){
v.linear.x = -MAX_LINEAR_VEL;
}else{
v.linear.x = 0;
}
//v.linear.x = navigationJoy->axes[axisLinear]*MAX_LINEAR_VEL;
v.angular.z = navigationJoy->axes[axisAngular]*MAX_ANGULAR_VEL;
}else{
v.linear.x = 0;
Expand Down

0 comments on commit bd50589

Please sign in to comment.