This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Mode definitions */ | |
#define MODE_INIT 0 | |
#define MODE_MANUAL 1 | |
#define MODE_GPS 2 | |
#define MODE_LAND 3 | |
static bool shutdown = false; | |
static int mode = MODE_INIT; | |
#define IMU_TIMES 2 // IMU read times per loop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h = 1/16 * [1, 4, 6, 4, 1]; | |
sample_pts = -36:1:37; | |
signal = my_signal(sample_pts); | |
num_pts = size(signal, 2); | |
g_0 = conv(signal, h, 'same'); % smooth pre subsample | |
g_1 = g_0(1:2:end); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
close all | |
clear | |
p200 = im2double(imread('photos/P200.jpg')); | |
[M N ~] = size(p200); | |
bench = im2double(imread('photos/bench.jpg')); | |
bench_m = im2double(imread('photos/bench_mask.jpg')); | |
cat = im2double(imread('photos/cat.jpg')); | |
cat_m = im2double(imread('photos/cat_mask.jpg')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
close all | |
clear | |
imga = im2double(imread('apple1.jpg')); | |
imgb = im2double(imread('orange1.jpg')); % size(imga) = size(imgb) | |
imga = imresize(imga,[size(imgb,1) size(imgb,2)]); | |
[M N ~] = size(imga); | |
v = 230; | |
level = 5; | |
limga = genPyr(imga,'lap',level); % the Laplacian pyramid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h = 1/16 * [1, 4, 6, 4, 1]; | |
sample_pts = -36:1:37; | |
sample_pts_1 = sample_pts(1:2:end); | |
signal = my_signal(sample_pts); | |
num_pts = size(signal, 2); | |
h_ = [h zeros(1, num_pts - 5)]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static IQueryable<Post> AddFiltersOnQuery(GetAllPostsFilter filter, IQueryable<Post> queryable) | |
{ | |
if (!string.IsNullOrEmpty(filter?.UserId)) | |
{ | |
queryable = queryable.Where(x => x.UserId == filter.UserId); | |
} | |
// Add other filtering logic here | |
return queryable; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public RequestToDomainProfile() | |
{ | |
CreateMap<PaginationQuery, PaginationFilter>(); | |
CreateMap<GetAllPostsQuery, GetAllPostsFilter>(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpGet(ApiRoutes.Posts.GetAll)] | |
[Cached(600)] | |
public async Task<IActionResult> GetAll([FromQuery] GetAllPostsQuery query, [FromQuery]PaginationQuery paginationQuery) | |
{ | |
var pagination = _mapper.Map<PaginationFilter>(paginationQuery); | |
var filter = _mapper.Map<GetAllPostsFilter>(query); | |
var posts = await _postService.GetPostsAsync(filter, pagination); | |
var postsResponse = _mapper.Map<List<PostResponse>>(posts); | |
if (pagination == null || pagination.PageNumber < 1 || pagination.PageSize < 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IPostService.cs | |
Task<List<Post>> GetPostsAsync(GetAllPostsFilter filter = null, PaginationFilter paginationFilter = null); | |
// PostsController.cs | |
public async Task<IActionResult> GetAll([FromQuery] GetAllPostsQuery query, [FromQuery]PaginationQuery paginationQuery) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GetAllPostsQuery | |
{ | |
[FromQuery(Name = "userId")] | |
public string UserId { get; set; } | |
} |