joel@Joels-Dell-XPS-8940:~/projects/foo_bar$ iex -S mix
Erlang/OTP 28 [erts-16.3] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]
Interactive Elixir (1.19.5) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> robot = MyRobot.robot()
%BB.Robot{
name: MyRobot,
root_link: :base,
...
}
...
iex(5)> robot.joints.pan_joint.limit.upper
** (KeyError) key :limit not found in:
%BB.Robot.Joint{
name: :pan_joint,
type: :revolute,
parent_link: :base,
child_link: :pan_link,
origin: %{position: {0.0, 0.0, 0.05}, orientation: {0.0, 0.0, 0.0}},
axis: {0.0, 0.0, 1.0},
limits: %{
upper: 1.5707963267948966,
lower: -1.5707963267948966,
effort: 5.0,
velocity: 1.0471975511965979
},
dynamics: nil,
sensors: [],
actuators: []
}
Did you mean:
* :limits
iex:5: (file)
iex(5)> robot.joints.pan_joint.limits.upper
1.5707963267948966
Start with a new mix project ...
joel@Joels-Dell-XPS-8940:~/projects$ mix new foo_bar
...
joel@Joels-Dell-XPS-8940:~/projects$ cd foo_bar/
joel@Joels-Dell-XPS-8940:~/projects/foo_bar$ vi mix.exs
joel@Joels-Dell-XPS-8940:~/projects/foo_bar$ tail mix.exs
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:bb, "~> 0.1"}
# {:dep_from_hexpm, "~> 0.3.0"},
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
]
end
end
joel@Joels-Dell-XPS-8940:~/projects/foo_bar$ cat <<EOF >lib/my_robot.ex
defmodule MyRobot do
use BB
topology do
link :base do
visual do
cylinder do
radius(~u(0.04 meter))
height(~u(0.05 meter))
end
...
end
end
end
end
end
EOF
Get dependencies.
joel@Joels-Dell-XPS-8940:~/projects/foo_bar$ mix deps.get
Resolving Hex dependencies...
...
joel@Joels-Dell-XPS-8940:~/projects/foo_bar$ iex -S mix
Erlang/OTP 28 [erts-16.3] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]
==> spark
Compiling 45 files (.ex)
Generated spark app
==> bb
Compiling 176 files (.ex)
Generating BB.Cldr for 2 locales named [:en, :und] with a default locale named :en
Generated bb app
==> foo_bar
Compiling 2 files (.ex)
Generated foo_bar app
Interactive Elixir (1.19.5) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> robot = MyRobot.robot()
%BB.Robot{
name: MyRobot,
root_link: :base,
links: %{
base: %BB.Robot.Link{
name: :base,
parent_joint: nil,
child_joints: [:pan_joint],
mass: nil,
center_of_mass: nil,
inertia: nil,
visual: %{
origin: nil,
geometry: {:cylinder, %{height: 0.05, radius: 0.04}},
material: %{
name: :material_2,
color: %{blue: 0.2, green: 0.2, red: 0.2, alpha: 1.0},
texture: nil
}
},
collisions: [],
sensors: []
},
pan_link: %BB.Robot.Link{
name: :pan_link,
parent_joint: :pan_joint,
child_joints: [:tilt_joint],
mass: nil,
center_of_mass: nil,
inertia: nil,
visual: %{
origin: {{0.0, 0.0, 0.015}, {0.0, 0.0, 0.0}},
geometry: {:box, %{x: 0.03, y: 0.03, z: 0.03}},
material: %{
name: :material_1,
color: %{blue: 0.3, green: 0.3, red: 0.3, alpha: 1.0},
texture: nil
}
},
collisions: [],
sensors: []
},
camera_link: %BB.Robot.Link{
name: :camera_link,
parent_joint: :tilt_joint,
child_joints: [],
mass: nil,
center_of_mass: nil,
inertia: nil,
visual: %{
origin: nil,
geometry: {:box, %{x: 0.05, y: 0.03, z: 0.03}},
material: %{
name: :material_0,
color: %{blue: 0.1, green: 0.1, red: 0.1, alpha: 1.0},
texture: nil
}
},
collisions: [],
sensors: []
}
},
joints: %{
pan_joint: %BB.Robot.Joint{
name: :pan_joint,
type: :revolute,
parent_link: :base,
child_link: :pan_link,
origin: %{position: {0.0, 0.0, 0.05}, orientation: {0.0, ...}},
...
},
...
},
...
}
iex(2)> Map.keys(robot.links)
[:base, :pan_link, :camera_link]
iex(3)> Map.keys(robot.joints)
[:pan_joint, :tilt_joint]
iex(4)> robot.joints.pan_joint.type
:revolute
iex(5)> robot.joints.pan_joint.limit.upper
** (KeyError) key :limit not found in:
%BB.Robot.Joint{
name: :pan_joint,
type: :revolute,
parent_link: :base,
child_link: :pan_link,
origin: %{position: {0.0, 0.0, 0.05}, orientation: {0.0, 0.0, 0.0}},
axis: {0.0, 0.0, 1.0},
limits: %{
upper: 1.5707963267948966,
lower: -1.5707963267948966,
effort: 5.0,
velocity: 1.0471975511965979
},
dynamics: nil,
sensors: [],
actuators: []
}
Did you mean:
* :limits
iex:5: (file)
iex(5)> robot.joints.pan_joint.limits.upper
1.5707963267948966
Code of Conduct
AI Policy
Versions
Operating system
Ubuntu 24.04.4 LTS running in 5.15.153.1-microsoft-standard-WSL2+
Current Behaviour
After completing Your First Robot steps 1-6, try Exploring the Compiled Robot. The expression
robot.joints.pan_joint.limit.uppergives an error and suggests, "Did you mean:limits?" The modified expressionrobot.joints.pan_joint.limits.uppergives the expected result.Reproduction
Start with a new mix project ...
Add Beam Bots to the project dependencies as described in Manual Installation.
Create a
my_robot.exfile as described in Step 1: Create the Module. Copy the Complete Example robot definition into the file.Get dependencies.
Explore the robot topology as described in "Exploring the Compiled Robot."
Expected Behaviour
Iex should evaluate the final expression in Exploring the Compiled Robot,
robot.joints.pan_joint.limit.upper, to 1.5707963267948966 (90 degrees in radians).