Search found 1017 matches

by fferri
26 Jan 2024, 23:43
Forum: General questions
Topic: Go to Goal in matlab
Replies: 3
Views: 700

Re: Go to Goal in matlab

You need to break down the problem into the smaller problems, e.g.: 1) deriving the robot's kinematic model 2) inverting the kinematic model 3) defining the attractive and repulsive potential fields using distance calculation module 4) moving the robot to walk the gradient of the potential field Can...
by fferri
25 Jan 2024, 16:12
Forum: General questions
Topic: Go to Goal in matlab
Replies: 3
Views: 700

Re: Go to Goal in matlab

Hi, you can move the robot by setting a target velocity for left and right wheel respectively ( vLeft and vRight ): sim.setJointTargetVelocity(motorLeft, vLeft) sim.setJointTargetVelocity(motorRight, vRight) and you can measure error with respect to target (assuming there is a dummy in the target po...
by fferri
19 Jan 2024, 11:43
Forum: General questions
Topic: Painting the robot's trace
Replies: 1
Views: 668

Re: Painting the robot's trace

With drawing objects.

E.g.:

Code: Select all

dwo = sim.addDrawingObject(sim.drawing_linestrip, 5, 0, -1, 1000, {1,0,0})
for i = 0, 100 do
    local x = math.cos(math.pi * 2 * i / 100)
    local y = math.sin(math.pi * 4 * i / 100)
    local z = 0.005
    sim.addDrawingObjectItem(dwo, {x, y, z})
end
by fferri
18 Jan 2024, 12:00
Forum: General questions
Topic: Create dummies on mesh programmatically
Replies: 2
Views: 830

Re: Create dummies on mesh programmatically

The way the Create dummies on mesh add-on works is by creating a proximity sensor pointing towards the mesh (from the camera viewpoint).

You can see implementation of function rayCast() here and copy it and adapt it to your needs.
by fferri
16 Jan 2024, 14:03
Forum: General questions
Topic: ros2 qos
Replies: 5
Views: 134287

Re: ros2 qos

Experimental support for QoS has been added to simROS2. You can create a qos struct in lua: --lua local qos = { history = simROS2.qos_history_policy.system_default, depth = 10, reliability = simROS2.qos_reliability_policy.system_default, durability = simROS2.qos_durability_policy.system_default, dea...
by fferri
30 Dec 2023, 14:53
Forum: General questions
Topic: URDF API
Replies: 3
Views: 17262

Re: URDF API

Works also in Python: [sandboxScript:info] Simulator launched, welcome! [simCmd:warning] Sandbox language: Python > sys.version '3.11.6 (main, Nov 2 2023, 04:39:43) [Clang 14.0.3 (clang-1403.0.22.14.1)]' > simURDF = require('simURDF') > [method for method in dir(simURDF) if not method.startswith('__...
by fferri
29 Dec 2023, 23:19
Forum: General questions
Topic: How to set the rotation speed when the rotation joint is in position mode
Replies: 1
Views: 12792

Re: How to set the rotation speed when the rotation joint is in position mode

Perhaps sim.setObjectFloatParam(jointHandle, sim.jointfloatparam_velocity, vel) or sim.setJointTargetVelocity
by fferri
29 Dec 2023, 23:16
Forum: General questions
Topic: Change robot joint mode through script
Replies: 1
Views: 8967

Re: Change robot joint mode through script

Yes:

Code: Select all

sim.setObjectInt32Param(jointHandle, sim.jointintparam_dynctrlmode, sim.jointdynctrl_position)
sim.setObjectInt32Param(jointHandle, sim.jointintparam_dynctrlmode, sim.jointdynctrl_velocity)
sim.setObjectInt32Param(jointHandle, sim.jointintparam_dynctrlmode, sim.jointdynctrl_force)
by fferri
27 Dec 2023, 11:45
Forum: General questions
Topic: data type with calling script in Matlab
Replies: 1
Views: 15584

Re: data type with calling script in Matlab

You need to ensure that all elements of the cell array are of the same type before using cell2mat. You can convert all elements to either double or single. You can iterate over the elements of the cell array and convert each element. e.g.: for i = 1:length(q_dq_data) q_dq_data{i} = double(q_dq_data{...