Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
permocar
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
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
Robert Hedman
permocar
Commits
7f537199
Commit
7f537199
authored
7 years ago
by
Robert Hedman
Browse files
Options
Downloads
Patches
Plain Diff
minor update/sync
parent
2e9c70af
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main.rs
+4
-5
4 additions, 5 deletions
src/main.rs
with
4 additions
and
5 deletions
src/main.rs
+
4
−
5
View file @
7f537199
...
@@ -20,13 +20,12 @@ use serial::prelude::*;
...
@@ -20,13 +20,12 @@ use serial::prelude::*;
// constants
// constants
const
LIDAR_ADDRESS
:
&
str
=
"127.0.0.1:8080"
;
const
LIDAR_ADDRESS
:
&
str
=
"127.0.0.1:8080"
;
const
COUNTER_SERIAL_PORT
:
&
str
=
"/dev/cu.usbmodem
4
1"
;
const
COUNTER_SERIAL_PORT
:
&
str
=
"/dev/cu.usbmodem1
422
"
;
// should the map matrix be two dim array of const size, vecs of dynamic, or what?
// should the map matrix be two dim array of const size, vecs of dynamic, or what?
const
ROWS
:
usize
=
50
;
const
ROWS
:
usize
=
50
;
const
COLS
:
usize
=
100
;
const
COLS
:
usize
=
100
;
static
mut
vec
=
vec!
[
vec!
[
0
;
COLS
];
ROWS
];
fn
main
()
{
fn
main
()
{
// dummy thread for replacing lidar
// dummy thread for replacing lidar
...
@@ -103,8 +102,8 @@ fn main() {
...
@@ -103,8 +102,8 @@ fn main() {
// get encoder data from arduino and update local variables
// get encoder data from arduino and update local variables
match
port
.read_exact
(
&
mut
serial_buf
){
match
port
.read_exact
(
&
mut
serial_buf
){
Ok
(
_
)
=>
{
Ok
(
_
)
=>
{
pos
.0
=
freq_to_distance
(
(
((
serial_buf
[
0
]
as
u32
)
<<
24
)
+
((
serial_buf
[
1
]
as
u32
)
<<
16
)
+
((
serial_buf
[
2
]
as
u32
)
<<
8
)
+
(
serial_buf
[
3
]
as
u32
)
)
as
i32
);
pos
.0
+
=
freq_to_distance
(
(
((
serial_buf
[
0
]
as
u32
)
<<
24
)
+
((
serial_buf
[
1
]
as
u32
)
<<
16
)
+
((
serial_buf
[
2
]
as
u32
)
<<
8
)
+
(
serial_buf
[
3
]
as
u32
)
)
as
i32
);
pos
.1
=
freq_to_distance
(
(
((
serial_buf
[
4
]
as
u32
)
<<
24
)
+
((
serial_buf
[
5
]
as
u32
)
<<
16
)
+
((
serial_buf
[
6
]
as
u32
)
<<
8
)
+
(
serial_buf
[
7
]
as
u32
)
)
as
i32
);
pos
.1
+
=
freq_to_distance
(
(
((
serial_buf
[
4
]
as
u32
)
<<
24
)
+
((
serial_buf
[
5
]
as
u32
)
<<
16
)
+
((
serial_buf
[
6
]
as
u32
)
<<
8
)
+
(
serial_buf
[
7
]
as
u32
)
)
as
i32
);
print!
(
"L: {}, "
,
pos
.0
);
print!
(
"L: {}, "
,
pos
.0
);
println!
(
"R: {}"
,
pos
.1
);
println!
(
"R: {}"
,
pos
.1
);
},
},
...
...
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