Skip to content

Commit 8f702e5

Browse files
committed
Add custom robot spec parameters for ER-Force sim
1 parent abfc527 commit 8f702e5

File tree

5 files changed

+214
-8
lines changed

5 files changed

+214
-8
lines changed

config/robot-specs.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ robot-specs:
1313
acc_brake_angular_max: 50
1414
vel_absolute_max: 3
1515
vel_angular_max: 20
16+
custom_erforce:
17+
shoot_radius: 0.07
18+
dribbler_height: 0.021
1619
"ER-Force":
1720
radius: 0.09
1821
height: 0.15
@@ -26,4 +29,7 @@ robot-specs:
2629
acc_brake_absolute_max: 6
2730
acc_brake_angular_max: 50
2831
vel_absolute_max: 3
29-
vel_angular_max: 20
32+
vel_angular_max: 20
33+
custom_erforce:
34+
shoot_radius: 0.07
35+
dribbler_height: 0.021

generateProto.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ protoc -I"./proto" -I"$GOPATH/src" --go_out="$GOPATH/src" proto/ssl_gc_game_even
2525
protoc -I"./proto" -I"$GOPATH/src" --go_out="$GOPATH/src" proto/ssl_gc_referee_message.proto
2626

2727
# simulation control
28+
protoc -I"./proto" -I"$GOPATH/src" --go_out="$GOPATH/src" proto/ssl_simulation_custom_erforce_robot_spec.proto
2829
protoc -I"./proto" -I"$GOPATH/src" --go_out="$GOPATH/src" proto/ssl_simulation_error.proto
2930
protoc -I"./proto" -I"$GOPATH/src" --go_out="$GOPATH/src" proto/ssl_simulation_config.proto
3031
protoc -I"./proto" -I"$GOPATH/src" --go_out="$GOPATH/src" proto/ssl_simulation_control.proto

internal/simctl/robot_specs.go

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package simctl
33
import (
44
"github.com/RoboCup-SSL/ssl-simulation-controller/internal/referee"
55
"github.com/golang/protobuf/proto"
6+
"github.com/golang/protobuf/ptypes/any"
67
"gopkg.in/yaml.v2"
78
"io/ioutil"
89
"log"
@@ -13,13 +14,14 @@ type TeamRobotSpecs struct {
1314
}
1415

1516
type RobotSpec struct {
16-
Radius float32 `yaml:"radius"`
17-
Height float32 `yaml:"height"`
18-
Mass float32 `yaml:"mass"`
19-
MaxLinearKickSpeed float32 `yaml:"max_linear_kick_speed"`
20-
MaxChipKickSpeed float32 `yaml:"max_chip_kick_speed"`
21-
CenterToDribbler float32 `yaml:"center_to_dribbler"`
22-
Limits Limits `yaml:"limits"`
17+
Radius float32 `yaml:"radius"`
18+
Height float32 `yaml:"height"`
19+
Mass float32 `yaml:"mass"`
20+
MaxLinearKickSpeed float32 `yaml:"max_linear_kick_speed"`
21+
MaxChipKickSpeed float32 `yaml:"max_chip_kick_speed"`
22+
CenterToDribbler float32 `yaml:"center_to_dribbler"`
23+
Limits Limits `yaml:"limits"`
24+
CustomErforce CustomRobotSpecErForce `yaml:"custom_erforce"`
2325
}
2426

2527
type Limits struct {
@@ -31,6 +33,11 @@ type Limits struct {
3133
VelAngularMax float32 `yaml:"vel_angular_max,omitempty"`
3234
}
3335

36+
type CustomRobotSpecErForce struct {
37+
ShootRadius float32 `yaml:"shoot_radius"`
38+
DribblerHeight float32 `yaml:"dribbler_height"`
39+
}
40+
3441
type RobotSpecSetter struct {
3542
c *SimulationController
3643

@@ -106,6 +113,20 @@ func mapRobotSpec(spec RobotSpec) (protoSpec *RobotSpecs) {
106113
protoSpec.MaxChipKickSpeed = &spec.MaxChipKickSpeed
107114
protoSpec.CenterToDribbler = &spec.CenterToDribbler
108115
protoSpec.Limits = mapRobotLimits(spec.Limits)
116+
117+
customErForce := RobotSpecErForce{
118+
ShootRadius: &spec.CustomErforce.ShootRadius,
119+
DribblerHeight: &spec.CustomErforce.DribblerHeight,
120+
}
121+
customErForceSerialized, err := proto.Marshal(&customErForce)
122+
if err != nil {
123+
log.Println("Could not serialize custom ER-Force robot specs: ", err)
124+
}
125+
customErForce.ProtoReflect().Descriptor().FullName()
126+
protoSpec.Custom = append(protoSpec.Custom, &any.Any{
127+
TypeUrl: "RobotSpecErForce",
128+
Value: customErForceSerialized,
129+
})
109130
return
110131
}
111132

internal/simctl/ssl_simulation_custom_erforce_robot_spec.pb.go

Lines changed: 167 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
syntax = "proto2";
2+
option go_package = "github.com/RoboCup-SSL/ssl-simulation-controller/internal/simctl";
3+
4+
// Custom robot specs for ER-Force simulator
5+
message RobotSpecErForce {
6+
// The distance [m] from the robot center to the ball, when the ball is as close as possible to the robot.
7+
// The ball may be a little bit inside the roboter when looking from top, due to the dimensions of the dribbler.
8+
optional float shoot_radius = 1;
9+
// The height of the dribbling bar from the ground [m]
10+
optional float dribbler_height = 2;
11+
}

0 commit comments

Comments
 (0)