Skip to content
Open
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
7001d91
feat: add gyakuenki subscriber
mbsaloka Nov 18, 2024
968b1cd
feat: add localization methods and attributes
mbsaloka Nov 21, 2024
6bb8a55
feat: run localize when odometry updated and projected objetcs not empty
mbsaloka Nov 21, 2024
4cd6c76
feat: add subscriber for delta position
mbsaloka Dec 3, 2024
a3e4132
fix: localize every get delta pos msg
mbsaloka Dec 5, 2024
a333ac1
feat: add subscriber for button status
mbsaloka Dec 5, 2024
8c8be98
feat: use landmark label to calculate likelihood
mbsaloka Dec 16, 2024
69ee83d
feat: update odometry use estimated pose
mbsaloka Dec 17, 2024
e57ca4b
feat: debug log
mbsaloka Dec 19, 2024
b942ba3
feat: debug and testing log
mbsaloka Dec 25, 2024
58d2418
fix: change attribute name
mbsaloka Jan 4, 2025
8c9f1b2
fix: apply estimate pose
mbsaloka Jan 7, 2025
7f39056
refactor: remove debug logs
mbsaloka Jan 7, 2025
faef1d4
feat: use counter to initialize particles across the field
mbsaloka Jan 7, 2025
06d20e2
fix: clear projected objects after evaluate particles
mbsaloka Jan 7, 2025
7f253d9
feat: validate delta pose before localize
mbsaloka Jan 9, 2025
81bd763
refactor: pass initial localization as method parameter
mbsaloka Jan 9, 2025
0eed5ef
docs: add copyrights
mbsaloka Jan 11, 2025
38fe626
refactor: clean up code
mbsaloka Jan 11, 2025
94f3573
fix: change particles initialization range
mbsaloka Jan 11, 2025
cfd0ec8
fix: swap field width and length in init particles
mbsaloka Jan 11, 2025
9938477
feat: validate estimated pose before apply using num particles
mbsaloka Jan 11, 2025
5da59ed
fix: use radian for trigonometri calculation
mbsaloka Jan 11, 2025
01b85a1
feat: add option to enable localization in config
mbsaloka Jan 13, 2025
b0f7c52
fix: improve loop code
mbsaloka Feb 24, 2025
d7b1f5a
feat: enhance resampling and pose estimate method
mbsaloka Mar 1, 2025
8f4fee1
fix: apply localization and update position bug
mbsaloka Mar 2, 2025
025cd46
feat: set particles number use config
mbsaloka Mar 2, 2025
d24ae4d
fix: adjust constant values and resolve stuck particles
mbsaloka Mar 15, 2025
6298403
fix: refine localization calculation
mbsaloka Mar 16, 2025
126190d
feat: add sigma to config
mbsaloka Mar 19, 2025
2f35942
feat: add particles publisher
mbsaloka Mar 19, 2025
7418faa
fix: fix reset particles
mbsaloka Mar 21, 2025
abdf34c
feat: add max object distance config
mbsaloka Mar 23, 2025
967f304
fix: resolve resampling problem
mbsaloka Mar 23, 2025
3706868
fix: change likelihood calculation from product to sum
mbsaloka Mar 23, 2025
ceea0fe
feat: publish estimated pose to particles topic
mbsaloka Mar 30, 2025
1aca1fb
fix: adding motion noise to motion update
mbsaloka Mar 31, 2025
750e8f3
feat: prevent particle evaluation when roll-pitch or pan-tilt out of …
mbsaloka Apr 9, 2025
058d455
fix: resample and initial particles
mbsaloka Apr 23, 2025
b957cd0
feat: use hungarian for landmark matching
mbsaloka Apr 23, 2025
ac5cc3b
refactor: remove unused debug code and tidy up
mbsaloka Apr 25, 2025
ef150af
feat: adjust constraint and coef for localization
mbsaloka May 9, 2025
ffbc119
feat: locomotion follow method for continuous scanning
mbsaloka May 9, 2025
2537233
feat: add jump rejection
mbsaloka May 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ find_package(ament_index_cpp REQUIRED)
find_package(aruku REQUIRED)
find_package(aruku_interfaces REQUIRED)
find_package(atama_interfaces REQUIRED)
find_package(gyakuenki_interfaces REQUIRED)
find_package(jitsuyo REQUIRED)
find_package(kansei REQUIRED)
find_package(kansei_interfaces REQUIRED)
Expand Down Expand Up @@ -47,6 +48,7 @@ ament_target_dependencies(${PROJECT_NAME}
aruku
aruku_interfaces
atama_interfaces
gyakuenki_interfaces
jitsuyo
kansei
kansei_interfaces
Expand Down Expand Up @@ -112,6 +114,7 @@ ament_export_dependencies(
aruku
aruku_interfaces
atama_interfaces
gyakuenki_interfaces
jitsuyo
kansei
kansei_interfaces
Expand Down
81 changes: 81 additions & 0 deletions include/suiryoku/locomotion/model/field.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// Copyright (c) 2025 Ichiro ITS
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#ifndef SUIRYOKU__LOCOMOTION__MODEL__FIELD_HPP_
#define SUIRYOKU__LOCOMOTION__MODEL__FIELD_HPP_
Comment thread
FaaizHaikal marked this conversation as resolved.

#include <vector>

#include "keisan/keisan.hpp"

namespace suiryoku
{

struct Field
{
public:
int width;
int length;
std::vector<keisan::Point2> landmarks_L;
std::vector<keisan::Point2> landmarks_T;
std::vector<keisan::Point2> landmarks_X;
std::vector<keisan::Point2> landmarks_goalpost;

Field()
: width(600),
length(900),
landmarks_L({
{0.0, 0.0},
{0.0, 600.0},
{100.0, 50.0},
{100.0, 550.0},
{900.0, 0.0},
{900.0, 600.0},
{800.0, 50.0},
{800.0, 550.0}
}),
landmarks_T({
{0.0, 50.0},
{0.0, 550.0},
{450.0, 0.0},
{450.0, 600.0},
{900.0, 50.0},
{900.0, 550.0}
}),
landmarks_X({
{210, 300},
{690, 300},
{450, 300},
{450, 375},
{450, 225}
}),
landmarks_goalpost({
{0.0, 170.0},
{0.0, 430.0},
{900.0, 170.0},
{900.0, 430.0}
})
{
}
};

} // namespace suiryoku

#endif // SUIRYOKU__LOCOMOTION__MODEL__FIELD_HPP_
44 changes: 44 additions & 0 deletions include/suiryoku/locomotion/model/robot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,24 @@
#include <string>

#include "keisan/keisan.hpp"
#include "suiryoku/locomotion/model/field.hpp"

namespace suiryoku
{

struct ProjectedObject
{
std::string label;
keisan::Point3 position;
};

struct Particle
{
keisan::Point2 position;
keisan::Angle<double> orientation;
double weight;
};

class Robot
{
public:
Expand All @@ -36,10 +50,35 @@ class Robot
keisan::Angle<double> get_pan() const;
keisan::Angle<double> get_tilt() const;

// localizations
void localize(bool initial_localization = false);
void init_particles(bool initial_localization);
void resample_particles();
void update_motion();
void calculate_weight();
void estimate_position();
void print_particles();
void print_estimate_position();
double calculate_total_likelihood(const Particle & particle);
double calculate_object_likelihood(const ProjectedObject & measurement, const Particle & particle);
double get_sum_weight();

Field field;
std::vector<Particle> particles;
keisan::Point2 estimated_position;
int num_particles;

bool use_localization;
bool apply_localization;

// IPM
std::vector<ProjectedObject> projected_objects;

// member for getting
bool is_calibrated;
keisan::Angle<double> orientation;
keisan::Point2 position;
keisan::Point2 delta_position;

bool is_walking;

Expand All @@ -57,6 +96,11 @@ class Robot
double y_speed;
double a_speed;
bool aim_on;

private:
double xvar;
double yvar;
int kidnap_counter;
};

} // namespace suiryoku
Expand Down
6 changes: 6 additions & 0 deletions include/suiryoku/locomotion/node/locomotion_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "aruku_interfaces/msg/set_walking.hpp"
#include "aruku_interfaces/msg/status.hpp"
#include "atama_interfaces/msg/head.hpp"
#include "gyakuenki_interfaces/msg/projected_objects.hpp"
#include "kansei_interfaces/msg/status.hpp"
#include "rclcpp/rclcpp.hpp"
#include "suiryoku/locomotion/model/robot.hpp"
Expand All @@ -42,6 +43,7 @@ class LocomotionNode
using Head = atama_interfaces::msg::Head;
using MeasurementStatus = kansei_interfaces::msg::Status;
using Point2 = aruku_interfaces::msg::Point2;
using ProjectedObjects = gyakuenki_interfaces::msg::ProjectedObjects;
using SetWalking = aruku_interfaces::msg::SetWalking;
using WalkingStatus = aruku_interfaces::msg::Status;

Expand Down Expand Up @@ -69,6 +71,10 @@ class LocomotionNode

rclcpp::Subscription<Head>::SharedPtr head_subscriber;

rclcpp::Subscription<ProjectedObjects>::SharedPtr projected_objects_subscriber;

rclcpp::Subscription<Point2>::SharedPtr delta_position_subscriber;

std::shared_ptr<Locomotion> locomotion;
std::shared_ptr<Robot> robot;

Expand Down
2 changes: 2 additions & 0 deletions include/suiryoku/locomotion/process/locomotion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ class Locomotion
keisan::Angle<double> right_kick_target_pan;
keisan::Angle<double> right_kick_target_tilt;

bool localization_enable;

std::shared_ptr<Robot> robot;
};

Expand Down
Loading