Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
asclinic-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jiaao Liu
asclinic-system
Commits
d48a8361
Commit
d48a8361
authored
8 months ago
by
Jiaao Liu
Browse files
Options
Downloads
Patches
Plain Diff
pwn change and meter information
parent
c34e901e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
catkin_ws/src/asclinic_pkg/src/forklift/control_node.cpp
+3
-3
3 additions, 3 deletions
catkin_ws/src/asclinic_pkg/src/forklift/control_node.cpp
catkin_ws/src/asclinic_pkg/src/forklift/odometry_new.cpp
+3
-3
3 additions, 3 deletions
catkin_ws/src/asclinic_pkg/src/forklift/odometry_new.cpp
with
6 additions
and
6 deletions
catkin_ws/src/asclinic_pkg/src/forklift/control_node.cpp
+
3
−
3
View file @
d48a8361
...
...
@@ -30,7 +30,7 @@ public:
};
PIDController
pid
(
3
,
0
,
5
);
PIDController
pid
(
3
0
,
0
,
5
);
PIDController
pid1
(
40
,
0
,
0
);
PIDController
pid_v
(
1.5
,
0
,
0
);
...
...
@@ -49,7 +49,7 @@ float ref_w = 0;
float
w_now
=
0
;
float
v_now
=
0
;
float
initial_pwm
=
2
5
;
float
initial_pwm
=
1
5
;
//initial 26.5
void
controlOperation
(
const
geometry_msgs
::
Twist
&
msg
)
{
float
flag
;
...
...
@@ -84,7 +84,7 @@ void pending(){
void
pureRotation
(
float
flag
)
{
float
rotating_pwm
=
1
5
;
float
rotating_pwm
=
1
0
;
float
right
;
float
left
;
if
(
flag
>
0
)
{
...
...
This diff is collapsed.
Click to expand it.
catkin_ws/src/asclinic_pkg/src/forklift/odometry_new.cpp
+
3
−
3
View file @
d48a8361
...
...
@@ -13,7 +13,7 @@ ros::Time time_previous, time_now; // Timing variables
ros
::
Duration
elapsed_time
;
// Duration to calculate elapsed time
// Robot's position and orientation variables
float
x
=
0.0
,
y
=
0.0
,
phi
=
0.0
;
float
x
=
0.0
,
y
=
0.0
,
phi
=
0.0
,
S
=
0.0
;
double
time_float
;
// Floating-point representation of elapsed time
...
...
@@ -76,7 +76,7 @@ void answer(const asclinic_pkg::LeftRightInt32& msg) {
// Calculate the linear displacement and change in orientation
float
dS
=
(
WHEEL_RADIUS_LEFT
*
deltaThetaL
+
WHEEL_RADIUS_RIGHT
*
deltaThetaR
)
/
2
;
float
dPhi
=
(
WHEEL_RADIUS_RIGHT
*
deltaThetaR
-
WHEEL_RADIUS_LEFT
*
deltaThetaL
)
/
(
2
*
HALF_WHEEL_BASE
);
S
+=
abs
(
dS
);
// Update position and orientation based on movements
x
+=
dS
*
cos
(
phi
+
0.5
*
dPhi
);
y
+=
dS
*
sin
(
phi
+
0.5
*
dPhi
);
...
...
@@ -107,7 +107,7 @@ void answer(const asclinic_pkg::LeftRightInt32& msg) {
float
angular_velocity
=
dPhi
/
time_float
;
// Log current position and angular velocity
ROS_INFO_STREAM
(
"Current Position - X:"
<<
x
<<
", Y:"
<<
y
<<
", Phi:"
<<
phi
<<
", Angular Velocity:"
<<
angular_velocity
);
ROS_INFO_STREAM
(
"Current Position - X:"
<<
x
<<
", Y:"
<<
y
<<
", Phi:"
<<
phi
<<
", Angular Velocity:"
<<
angular_velocity
<<
", Total distance:"
<<
S
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment