Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
csm
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
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
labrobotica
algorithms
csm
Commits
83bec038
Commit
83bec038
authored
16 years ago
by
Andrea Censi
Browse files
Options
Downloads
Patches
Plain Diff
No commit message
No commit message
parent
b17c2757
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
sm/apps/ld_noise.c
+2
-1
2 additions, 1 deletion
sm/apps/ld_noise.c
sm/apps/raytracer/raytracer.cpp
+14
-1
14 additions, 1 deletion
sm/apps/raytracer/raytracer.cpp
sm/csm/laser_data.c
+5
-0
5 additions, 0 deletions
sm/csm/laser_data.c
sm/csm/laser_data_json.c
+6
-2
6 additions, 2 deletions
sm/csm/laser_data_json.c
with
27 additions
and
4 deletions
sm/apps/ld_noise.c
+
2
−
1
View file @
83bec038
...
...
@@ -82,7 +82,8 @@ int main(int argc, const char * argv[]) {
}
else
have_alpha
=
0
;
if
(
have_alpha
)
{
double
beta
=
alpha
-
ld
->
theta
[
i
];
/* Recall that alpha points outside the surface */
double
beta
=
(
alpha
+
M_PI
)
-
ld
->
theta
[
i
];
add_sigma
=
p
.
sigma
/
cos
(
beta
);
}
else
{
sm_error
(
"Because lambertian is active, I need either true_alpha[] or alpha[]"
);
...
...
This diff is collapsed.
Click to expand it.
sm/apps/raytracer/raytracer.cpp
+
14
−
1
View file @
83bec038
...
...
@@ -11,6 +11,8 @@ struct raytracer_params {
bool
load_env_from_json
(
Environment
&
env
,
JO
jo
);
double
cosine_between_angles
(
double
a1
,
double
a2
);
int
main
(
int
argc
,
const
char
**
argv
)
{
...
...
@@ -84,7 +86,14 @@ int main(int argc, const char** argv)
ld
->
valid
[
i
]
=
1
;
ld
->
readings
[
i
]
=
rho
;
ld
->
true_alpha
[
i
]
=
normalize_0_2PI
(
alpha
-
ld
->
true_pose
[
2
]);
double
relative_alpha
=
alpha
-
ld
->
true_pose
[
2
];
/* Make sure alpha points out of the wall */
if
(
cosine_between_angles
(
relative_alpha
,
ld
->
theta
[
i
])
>
0
)
{
relative_alpha
+=
M_PI
;
}
ld
->
true_alpha
[
i
]
=
normalize_0_2PI
(
relative_alpha
);
}
else
{
ld
->
valid
[
i
]
=
0
;
...
...
@@ -130,6 +139,10 @@ int main(int argc, const char** argv)
return false; \
}
double
cosine_between_angles
(
double
a1
,
double
a2
)
{
return
cos
(
a1
)
*
cos
(
a2
)
+
sin
(
a1
)
*
sin
(
a2
);
}
bool
load_env_from_json
(
Environment
&
env
,
JO
jo_map
)
{
jo_expect_object
(
jo_map
);
...
...
This diff is collapsed.
Click to expand it.
sm/csm/laser_data.c
+
5
−
0
View file @
83bec038
...
...
@@ -245,6 +245,11 @@ int ld_valid_fields(LDP ld) {
return
0
;
}
if
(
!
is_nan
(
ld
->
readings_sigma
[
i
])
&&
ld
->
readings_sigma
[
i
]
<
0
)
{
sm_error
(
"Ray #%d: has invalid readings_sigma %f
\n
"
,
i
,
ld
->
readings_sigma
[
i
]);
return
0
;
}
}
/* Checks that there is at least 10% valid rays */
int
num_valid
=
count_equal
(
ld
->
valid
,
ld
->
nrays
,
1
);
...
...
This diff is collapsed.
Click to expand it.
sm/csm/laser_data_json.c
+
6
−
2
View file @
83bec038
...
...
@@ -234,8 +234,12 @@ LDP ld_from_json_stream(FILE*file) {
jo
=
json_read_stream
(
file
);
if
(
!
jo
)
{
if
(
!
feof
(
file
))
if
(
!
feof
(
file
))
{
fprintf
(
stderr
,
" (!)
\n
"
);
sm_error
(
"Invalid JSON found.
\n
"
);
}
fprintf
(
stderr
,
" EOF
\n
"
);
return
0
;
}
...
...
@@ -246,7 +250,7 @@ LDP ld_from_json_stream(FILE*file) {
}
jo_free
(
jo
);
fprintf
(
stderr
,
"
j
"
);
fprintf
(
stderr
,
"
l
"
);
return
ld
;
}
...
...
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