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
38a627fd
Commit
38a627fd
authored
11 months ago
by
Jiaao Liu
Browse files
Options
Downloads
Patches
Plain Diff
time constrain
parent
4434d8e8
Branches
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/Kalman.cpp
+10
-3
10 additions, 3 deletions
catkin_ws/src/asclinic_pkg/src/Kalman.cpp
catkin_ws/src/asclinic_pkg/src/fcontroller1.cpp
+1
-1
1 addition, 1 deletion
catkin_ws/src/asclinic_pkg/src/fcontroller1.cpp
with
11 additions
and
4 deletions
catkin_ws/src/asclinic_pkg/src/Kalman.cpp
+
10
−
3
View file @
38a627fd
...
...
@@ -19,7 +19,9 @@ float x = -1, y = -3, phi = 0.0;/////////////////////////////////////////////
int
left_p
=
1
,
right_p
=
1
;
ros
::
Time
time_previous
,
time_now
;
// Timing variables
ros
::
Duration
elapsed_time
;
// Duration to calculate elapsed time
ros
::
Time
constrain_time
;
ros
::
Time
begin_time
;
ros
::
Duration
constrain_duration
;
double
time_float
;
// Floating-point representation of elapsed time
...
...
@@ -122,7 +124,12 @@ void answer(const asclinic_pkg::LeftRightInt32& msg) {
void
ImageAnswer
(
const
asclinic_pkg
::
position
&
msg
)
{
constrain_time
=
ros
::
Time
::
now
();
constrain_duration
=
constrain_time
-
begin_time
;
float
temp_value
=
constrain_duration
.
toSec
();
if
(
temp_value
<
30
)
{
return
;
}
// Check if elapsed time is less than 0.5 seconds
if
(
authority
==
0
)
{
return
;
...
...
@@ -218,7 +225,7 @@ int main(int argc, char **argv) {
ros
::
init
(
argc
,
argv
,
"Kalman"
);
std
::
string
ns_for_group
=
ros
::
this_node
::
getNamespace
();
ros
::
NodeHandle
nh
(
ns_for_group
);
begin_time
=
ros
::
Time
::
now
();
// Initialize time_now to current time
time_now
=
ros
::
Time
::
now
();
...
...
This diff is collapsed.
Click to expand it.
catkin_ws/src/asclinic_pkg/src/fcontroller1.cpp
+
1
−
1
View file @
38a627fd
...
...
@@ -58,7 +58,7 @@ float w_now = 0;
float
v_now
=
0
;
int
state_value
=
2
;
// 0 is forward, 1 is rotate , 2 is pending
float
initial_pwm
=
2
4
;
float
initial_pwm
=
2
5
;
//initial 26.5
void
straightline
(
const
asclinic_pkg
::
vw
&
vw_msg
)
{
...
...
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